Repository navigation
release.sh: merge bump PR after publication and recover failed unpublished releases on resume #1674
Description
This was generated by AI during triage.
Context
When cutting 0.18.8, scripts/release.sh pushed tag v0.18.8, immediately merged the bump PR (#1661) into main, and then waited for the Release workflow (release.yml). A transient GitHub Actions artifact download failure broke build-local-artifacts (x86_64-unknown-linux-musl) before host or custom-publish-crates ran, so v0.18.8 was never published to GitHub Releases or crates.io.
Because the bump PR had already been merged into main and v0.18.8 was already tagged on the old bump commit:
- Re-running
bash scripts/release.sh 0.18.8exited1immediately, telling the operator to rungh run rerun --failed <id>by hand and then invokerelease.sha third time. - Meanwhile, new commits landed on
mainwithCargo.tomlalready at0.18.8, andrelease.sh 0.18.8had no way to re-cut the unpublished0.18.8release from the latest green commit onmain.
Agent Brief
Category: enhancement
Summary: Merge the bump PR only after the release workflow succeeds, and make re-running release.sh <version> after a failed unpublished release workflow either re-cut from a newer green main commit or automatically rerun the failed workflow jobs.
Current behavior:
scripts/release.shopens therelease-<version>bump PR, waits for its checks, tags the bump commit asv<version>, and immediately merges the bump PR intomainbefore waiting for the release workflow.- If the release workflow fails before publishing the GitHub Release,
mainalready carries the bumpedCargo.toml/Cargo.lockversion and the merged bump PR. - Re-running
scripts/release.sh <version>after a release workflow failure sees the completed failed run and exits1again without rerunning the failed jobs or checking whethermainhas advanced to a newer green commit.
Desired behavior:
- Merge after publication.
scripts/release.shtags the bump commit at the head ofrelease-<version>, pushesv<version>, and waits for the release workflow to succeed before merging the bump PR intomain. Once the release workflow succeeds, it merges the open bump PR with a merge commit (if not already merged) and prints the GitHub Release URL. As before, if merging the bump PR fails after the release workflow has succeeded, the published release stands: the script prints the warning naming the PR for the Day shift to merge and exits0. - Resuming when the release workflow already succeeded (or the GitHub Release exists) but the bump PR is still open. If
v<version>is onoriginat the head ofrelease-<version>and the release workflow run succeeded, a resumed run merges the still-open bump PR, prints the GitHub Release URL, and exits0. - Resuming after a failed release workflow when
v<version>is not yet published: Whenv<version>is already tagged onoriginat the head ofrelease-<version>, its latest release workflow run completed in failure, and no GitHub Release exists yet forv<version>(gh release view v<version>fails):- Newer green
maincommit available: Ifmainhas a commit newer than the current bump commit's base (head^1) whose latest pushCIrun succeeded, re-cutrelease-<version>from that newest greenmaincommit:- Run the release Experiment on the new base when
--with-experimentis passed. - Regenerate the release summary and version diff (honoring
--reviewif passed). - Force-push the new bump commit to
refs/heads/release-<version>onoriginand update the open bump PR's body (gh pr edit). - Wait for the bump PR's checks on the new bump commit.
- Force-push the
v<version>tag onorigin(git push --force --quiet origin "$head:refs/tags/$tag") to the new bump commit, wait for the new release workflow run to succeed, and then merge the bump PR.
- Run the release Experiment on the new base when
- No newer green
maincommit: Automatically rerun the failed jobs of the release workflow run withgh run rerun --failed <id>, print a stamped progress line noting that it reran the failed jobs, and wait for the rerun to complete (and then merge the bump PR on success).
- Newer green
- Published releases are never moved. If a GitHub Release for
v<version>already exists,release.shnever force-pushesrelease-<version>or movesv<version>.
Key interfaces:
scripts/release.shworkflow ordering (wait_for_releasebeforemerge_bump_pr), resume detection, and release workflow recovery.scripts/release.shtop-level documentation comments,docs/guide.md, and the generated user manual (site/docs/index.htmlvianpm run docs --prefix site).- Fake
ghandgitharness in the release integration test suite (gh run rerun --failed,gh pr edit,gh release view).
Acceptance criteria:
- On a fresh run,
scripts/release.sh <version>pushesv<version>on the bump commit, waits for the release workflow to succeed, and only merges the bump PR after the release workflow succeeds. - If the release workflow fails on the first run, the bump PR remains open and unmerged (so
main'sCargo.tomlis not bumped before publication), and the script exits1naming the failed jobs and run URL. - Re-running
scripts/release.sh <version>after a failed release workflow when no GitHub Release exists andmainhas no newer green commit runsgh run rerun --failed <id>, waits for the rerun to succeed, merges the bump PR, and exits0. - Re-running
scripts/release.sh <version>after a failed release workflow when no GitHub Release exists andmainhas a newer green commit re-cutsrelease-<version>from the newer green commit, updates the open bump PR body, waits for PR checks, force-pushesv<version>to the new bump commit, waits for the release workflow, merges the bump PR, and exits0. - Resuming when
v<version>'s release workflow already succeeded while the bump PR is still open merges the bump PR, prints the GitHub Release URL, and exits0. - Documentation (
scripts/release.shheader comment,docs/guide.md, and generatedsite/docs/index.html) and the release test suite are updated to match.
Out of scope:
- Changing
.github/workflows/release.ymlor cargo-dist configuration. - Automatically retrying failed jobs inside the initial
release.shinvocation without the operator re-runningrelease.sh(the initial failure still exits1so the operator sees it; re-runningrelease.sh <version>performs the recovery).
Activity