| 303 | } |
| 304 | |
| 305 | fn publish(krate: &Crate) -> bool { |
| 306 | if !CRATES_TO_PUBLISH.iter().any(|s| *s == krate.name) { |
| 307 | return true; |
| 308 | } |
| 309 | |
| 310 | // First make sure the crate isn't already published at this version. This |
| 311 | // script may be re-run and there's no need to re-attempt previous work. |
| 312 | let output = curl(&format!("https://crates.io/api/v1/crates/{}", krate.name)); |
| 313 | if output.is_none() { |
| 314 | println!( |
| 315 | "skip publish {} because {} is latest version", |
| 316 | krate.name, krate.version, |
| 317 | ); |
| 318 | return true; |
| 319 | } |
| 320 | |
| 321 | let status = Command::new("cargo") |
| 322 | .arg("publish") |
| 323 | .current_dir(krate.manifest.parent().unwrap()) |
| 324 | .arg("--no-verify") |
| 325 | .status() |
| 326 | .expect("failed to run cargo"); |
| 327 | if !status.success() { |
| 328 | println!("FAIL: failed to publish `{}`: {}", krate.name, status); |
| 329 | return false; |
| 330 | } |
| 331 | |
| 332 | true |
| 333 | } |
| 334 | |
| 335 | // Verify the current tree is publish-able to crates.io. The intention here is |
| 336 | // that we'll run `cargo package` on everything which verifies the build as-if |