diff --git a/scripts/publish.rs b/scripts/publish.rs index 34248ac664a9..7c3446451303 100644 --- a/scripts/publish.rs +++ b/scripts/publish.rs @@ -419,15 +419,16 @@ fn publish(krate: &Crate) -> bool { // First make sure the crate isn't already published at this version. This // script may be re-run and there's no need to re-attempt previous work. - let output = cmd_output( - Command::new("curl").arg(&format!("https://crates.io/api/v1/crates/{}", krate.name)), - ); + let output = cmd_output(Command::new("curl").arg(&format!( + "https://crates.io/api/v1/crates/{}/versions", + krate.name + ))); if output.status.success() && String::from_utf8_lossy(&output.stdout) - .contains(&format!("\"newest_version\":\"{}\"", krate.version)) + .contains(&format!("\"num\":\"{}\"", krate.version)) { println!( - "skip publish {} because {} is latest version", + "skip publish {} because {} is already published", krate.name, krate.version, ); return true;