Repository navigation
Description
Problem Statement
The release script finishes when it pushes the v<version> tag. Its last line is release: tagged v0.5.0 on 55bcf6e and pushed the tag, and it exits 0. The GitHub Release doesn't exist yet at that point. Pushing the tag only starts the release workflow. That workflow builds the binaries and installer, runs the Rocky Linux and WSL smoke checks, publishes the GitHub Release, publishes to crates.io and then replaces the Release body.
When releasing 0.5.0, the maintainer checked GitHub right after the script exited, found no v0.5.0 Release and took the release as failed. The release workflow was still running and published the Release about 6 minutes later. Nothing in the script's output said the release was still going, or where to watch it.
Solution
A release now finishes when the release workflow run for the tag has succeeded, not when the tag is pushed. At that point the GitHub Release is published with its final body and the crate is on crates.io.
- After pushing the tag, the script prints a progress line with the release workflow run's URL, then waits until that run finishes.
- If the run succeeds, it prints the GitHub Release's URL and exits 0.
- If the run fails, it exits 1. It names the failed jobs and the run URL and suggests
gh run rerun --failed <run id>. It leaves the tag in place: the tag is already public, and deleting it is worse than rerunning failed jobs. - A rerun of the script that finds the tag already on the merge of the bump PR no longer stops with "nothing left to do". It picks up from the release workflow run instead:
- still going: it waits
- succeeded: it prints the GitHub Release's URL and exits 0
- failed: it fails as in step 3
User Stories
- As a maintainer, I want the release script to exit 0 only once the GitHub Release is published, so that a 0 exit means the release is done.
- As a maintainer, I want the script to print the release workflow run's URL as soon as it starts waiting, so that I can watch the build if I want to.
- As a maintainer, I want the script to print the GitHub Release's URL at the end, so that I can open it and check the notes and assets.
- As a maintainer, I want the script to wait for the whole release workflow run, including crates.io and the Release body rewrite, so that "done" covers every channel users install from.
- As a maintainer, I want the script to wait only for the release workflow run, not CI on
mainfor the same merge commit, so that it doesn't wait on a run that can't change what gets published. - As a maintainer, I want the script to keep polling when the release workflow run isn't listed yet right after the tag push, so that a slow GitHub doesn't read as "no run, nothing to wait for".
- As a maintainer, I want a failed release workflow run to make the script exit 1, naming the failed jobs and the run URL, so that I know the release is incomplete and where to look.
- As a maintainer, I want the failure message to suggest
gh run rerun --failed <run id>, so that I know how to recover without cutting a new version. - As a maintainer, I want the script never to delete or move the tag after a failed release workflow run, so that a public tag doesn't change under anyone.
- As a maintainer, I want to be able to stop the script with Ctrl-C while it waits and rerun it with the same version to carry on waiting, so that the wait resumes like every other step.
- As a maintainer, I want a rerun after a successful release workflow run to print the GitHub Release's URL and exit 0, so that rerunning a finished release is harmless.
- As a maintainer, I want a rerun after a failed release workflow run to fail as in story 7, so that a rerun never reports a broken release as done.
- As a maintainer, I want a rerun after I reran the failed jobs to see the rerun's outcome, so that the script reports the state the release is actually in.
- As a maintainer, I want the wait to have no overall timeout, like the wait for the bump PR's CI, so that a slow runner doesn't make a healthy release look failed.
- As a maintainer, I want the README's release section and the script's header comment to describe the new stopping point, exit codes and resume behaviour, so that the docs match what the script does.
- As a maintainer, I want the docs to keep "GitHub Release" (what gets published) and "release workflow" (the Actions run that publishes it) apart, so that "the release" is no longer ambiguous.
Implementation Decisions
- Where the change lives: only in the release script. The release workflows (
release.yml, the smoke checks, the crates.io publish and the release notes) don't change. - How the run is found: the release workflow's run for the
pushevent on the bump PR's merge commit. CI's push run onmainfor the same commit is ignored. - Polling: until the run exists, then until it completes, at the same poll interval as the CI wait (
RELEASE_POLL_SECONDS), with no overall timeout. - What counts as success: the run's conclusion. Success means dist published the GitHub Release and then the crates.io and release-notes jobs ran.
- Which attempt counts: after
gh run rerun --failed, the run's current attempt. A later rerun of the script reports that attempt's result. - Resume: the "tag already on the merge of the bump PR" path waits on or reports the release workflow run instead of exiting. A tag elsewhere on origin is still refused.
- Exit codes: 0 once the release workflow run has succeeded. 1 when it failed, with the tag left in place. The existing exit codes for refusals, a "no" at the review and failed PR checks don't change.
- Progress lines: they stay on stderr, one per step, in the script's existing
release: …style. There's a new line when the wait starts (with the run URL) and a new last line on success (with the GitHub Release URL). - Domain language: no change to
CONTEXT.md. Releasing is maintainer tooling, not part of thirdshift's domain. - ADR: none. The change is easy to reverse.
Testing Decisions
- The seam: the existing release script tests, which run the real script against the fake
gh(and fakeclaude) and assert on exit code, stderr progress lines and the calls made. No new seam. The fakeghgets whatever it needs to model release workflow runs: not yet listed, in progress, succeeded, failed, and a rerun attempt. - Test only outward behaviour: exit codes, what is printed, what is pushed. Not how the script polls.
- Cases to cover:
- After the tag is pushed, the run is listed only after a few polls; the script waits, then exits 0 with the GitHub Release URL.
- The run fails: exit 1, the failed job names and run URL are printed, and the tag isn't deleted or moved.
- A CI run on
mainfor the merge commit that fails or is still running doesn't hold up or fail the release. - A rerun with the tag on the merge while the run is in progress waits, then succeeds.
- A rerun with the tag on the merge after a successful run exits 0 with the GitHub Release URL and pushes nothing.
- A rerun with the tag on the merge after a failed run exits 1 as above.
- A tag on origin that isn't on the merge of the bump PR is still refused.
- Prior art: the existing tests that cover the CI wait on the bump PR and resuming after an interrupted run (for example, rerunning after the branch was pushed).
- Updating the old test: the test asserting the current "already tagged, nothing left to do" exit changes to the new resume behaviour.
Out of Scope
- Changing the release workflow, the smoke checks, crates.io publishing or the release notes.
- Deleting, moving or re-pushing the tag after a failed release workflow run.
- An overall timeout on the wait.
- Waiting for CI on
mainafter the merge. - A flag to skip the wait.
- Adding release terms to
CONTEXT.md.
Further Notes
- What happened with 0.5.0: the tag was pushed at 19:32:20 UTC and the release workflow published the GitHub Release at 19:37:59. crates.io followed at 19:39:37 and the final Release body at 19:39:57 (run 36766380629). The script had exited at the tag push, so the Release looked missing.
- What this adds to a release: about 7–8 minutes on top of the bump PR's CI wait.
Activity