Repository navigation
Release script: one command from version to pushed tag - #165
Merged
Merged
Conversation
scripts/release.sh <version> bumps the version on origin/main in a
temporary worktree, opens the release-<version> PR with GitHub's
generated notes in a marked summary section and the version diff, waits
for its checks, merges it with a merge commit, and tags and pushes
v<version> on that merge commit. Failing checks leave the PR open.
The fake gh gains the generate-notes API, a merged PR's merge commit, a
one-line-per-run form of the check-runs endpoint and gh's {owner}/{repo}
placeholder.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dist release workflow also runs on pull requests, and its build jobs
only appear once its plan job finishes, so a commit's check runs can all
be complete before CI is. A workflow run completes only with all its
jobs, so the script now waits on those.
With inherit_errexit, a failing gh call inside a command substitution,
such as generating the notes, stops the script instead of opening the PR
with an empty summary. The fake gh shares its -f parsing and treats
{owner}/{repo} in check_repo.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/release.sh <version>goes from a version number to a pushedv<version>tag, which starts the existingdistrelease workflow.It waits on workflow runs rather than check runs because
release.ymlalso runs onpull_request, and its build jobs only appear afterplanfinishes. The generated notes cover the PRs merged since the lastv*tag (previous_tag_name), withtarget_commitishset to theorigin/maincommit.Evidence
Before: there was no release script. Releasing was the three manual README steps.
After:
cargo test --test releasepasses 6 tests:versionin both files; the merge commit's parents are (old main, bump head);v0.2.0on origin points at that merge commitv0.1.0(and not the PR from before the tag), followed by the version diffOPEN, doesn't move main and pushes no tagwipbranch, local edits, untracked files, unpushed commit, branch list and worktree list are all unchanged, and none of them leak into the releaseThe full
cargo test,cargo clippy --all-targets -D warningsandshellcheck scripts/release.share clean.Real stderr from the test run:
Unaddressed findings
Spec
RELEASE_POLL_SECONDSis an extra knob. It is kept as the test seam for the poll interval and documented in the script header. A maintainer never needs to set it.previous_tag_namecomes from local tags (git describe). Fetchingmainauto-follows tags, so local tags normally mirror origin. Fetching origin's tags into the maintainer's repo risks clobbering their local tags. The refusals ticket is a better place to revisit this.{owner}/{repo}is ambiguous in a clone with several remotes and nogh repo set-default. This clone has a singleorigin. DerivingGH_REPOfrom the origin URL would need a GitHub-shaped origin in the tests. Left for when that case comes up.gh pr view --json mergeCommitinstead of git. The reviewer marked this "not a bug". Finding the merge onorigin/mainwhose second parent is the head is exact, and it only reads from git.Standards
--jqstrings so an unexpected call fails loudly.isolated()/git()duplicate the helpers insite_deploy.rsandsupport/mod.rs. This follows the existing per-file prior art. The nameisolatedstays because, unlikewithout_user_git_config, it also sets the git identity.new→ci_reports(GREEN)→ run) repeats across tests. The repeated Arrange step keeps each test readable on its own. The duplicatedheadRefOidlookup was extracted intopr_head.Merge Danger
Door: two-way
This only adds a maintainer script, a test and extensions to the fake. Nothing ships in the binary, because the crate's
includeleavesscripts/out. Running the script is one-way: the pushed tag publishes to crates.io. Merging this PR runs nothing.Blast Radius: tooling
The fake
ghchanges are additive. The{owner}/{repo}acceptance and the shared-fparsing touch paths the existing tests use, and the full suite passes.Closes #156
🤖 Generated with Claude Code