| 1 |
// Publish this crate to crates.io. |
| 2 |
// |
| 3 |
// A library has no per-platform artifact, so this is the whole release: one |
| 4 |
// recipe, run on whichever host the manifest names. |
| 5 |
// |
| 6 |
// The preflight step is the point of routing this through Bento. crates.io |
| 7 |
// versions can be yanked but never edited, so a wrong repository URL, a |
| 8 |
// missing license, or a duplicate version is permanent the moment it uploads. |
| 9 |
// pter 0.1.0 went out with a dead repository link and could only be corrected |
| 10 |
// by releasing again. |
| 11 |
|
| 12 |
let h = build_host(); |
| 13 |
let r = repo(); |
| 14 |
let v = version(); |
| 15 |
|
| 16 |
step("checkout"); |
| 17 |
sh_ok(h, "cd " + r + " && git pull --ff-only"); |
| 18 |
|
| 19 |
step("build"); |
| 20 |
sh_ok(h, "cd " + r + " && cargo test " + feature_flags()); |
| 21 |
|
| 22 |
step("verify"); |
| 23 |
// Credentials are checked here too, and deliberately not passed through Bento: |
| 24 |
// the token stays in cargo's own 0600 store on the publishing host, where cargo |
| 25 |
// finds it. Handing it to a shell command would put it in the process list for |
| 26 |
// the length of the upload, and ops-exec renders env pairs into the shell line. |
| 27 |
// Aborts the run with the specific problems if anything is wrong. |
| 28 |
log(crate_preflight()); |
| 29 |
sh_ok(h, "cd " + r + " && cargo publish --dry-run " + feature_flags()); |
| 30 |
|
| 31 |
step("publish"); |
| 32 |
sh_ok(h, "cd " + r + " && cargo publish " + feature_flags()); |
| 33 |
log("published " + v + " to crates.io"); |
| 34 |
|