Cutting a Release
A release is produced by merging one pull request. Nothing is hand-edited: not the version, not the changelog, not the tag.
The loop
merge to main
|
v
release-plz release-pr -> opens or updates "chore: release vX.Y.Z"
| - bumps [workspace.package].version
| - adds the CHANGELOG.md section
v
you merge that PR
|
v
release-plz release -> pushes the tag vX.Y.Z
|
v
release.yml -> builds 5 platform binaries, computes
sha256sums.txt, creates the GitHub release
with the CHANGELOG.md section as its body
The release pull request is long-lived. Every merge to main updates it in place,
so it always shows the version and the notes you would get by releasing right now.
Ignore it for a month and it keeps accumulating; there is no deadline attached to
it and no cost to leaving it open.
Both halves live in .github/workflows/release-plz.yml,
and the binary build is unchanged in
.github/workflows/release.yml.
Releasing
- Open the release pull request. Read the
CHANGELOG.mddiff as a user would: this is the text that becomes the release notes. - Fix anything that reads badly by editing
CHANGELOG.mdon that branch. The next push tomainleaves your edits alone and appends to them. - Merge it.
- Watch the Release workflow. It must finish with five archives and
sha256sums.txtattached. A release with no assets means the tag did not trigger the build — see the token.
To not release, do nothing. That is the whole mechanism.
The version number
The next version is computed from the Conventional Commit subjects since the last
tag, and all ten crates move together — they share
[workspace.package].version, and release-plz.toml puts them in one
version_group so none of them can drift.
| Commits since the last tag | Next version from 0.2.0 |
|---|---|
only fix, docs, chore, … | 0.2.1 |
any feat | 0.3.0 |
any ! breaking marker | 0.3.0 |
Pre-1.0, release-plz's own default is that a feature bumps only the patch.
features_always_increment_minor = true overrides that, because the 0.x minor is
what Cargo treats as the compatibility boundary and because this repo's history
already works that way — v0.1.0 to v0.2.0 was a feature release.
While the version is below 1.0 a breaking change and a feature are indistinguishable in the number. That is 0.x, not a configuration mistake.
What goes in the changelog
Sections come from the commit type, and the crate shows up as the scope on each
line. chore, test, ci, build and style commits are dropped: they change
nothing a user of the binary can observe, and the git history is where someone
looking for them will go. A commit marked breaking with ! is never dropped,
whatever its type.
Dependency bumps are the exception among chores — they are how a security
advisory reaches a user — so chore(deps) gets its own Dependencies section.
The mapping lives in [changelog].commit_parsers in
release-plz.toml.
Check the diff, don't trust it. release-plz attributes a commit to a crate by the files it touches, and on this workspace it has been observed to leave commits out. Reviewing the
CHANGELOG.mddiff in the release pull request is therefore part of releasing, not a formality — and it is why generating the notes into a reviewable pull request is better than generating them at tag time.
The token
This is the part that has to be right. A tag pushed with the default
GITHUB_TOKEN does not trigger other
workflows. release.yml triggers on
push: tags: ["v*"], so with the default token the tag lands, and the binaries
are never built — with nothing anywhere reporting a failure.
So both jobs read a RELEASE_PLZ_TOKEN secret, and skip with a warning when it
is absent rather than pushing a tag that goes nowhere. Until the secret exists,
releases stay manual and the workflow is inert.
Either of these works. A GitHub App is better — the release pull request is authored by a bot rather than attributed to a person, and there is no personal credential to rotate — but a fine-grained PAT is much less setup.
A fine-grained PAT. Settings → Developer settings → Personal access tokens →
Fine-grained tokens. Scope it to this repository, grant Contents: read and
write and Pull requests: read and write, then store it as the repository
secret RELEASE_PLZ_TOKEN.
A GitHub App. Create an app with the same two permissions, install it on the repository, and store its id and private key as secrets. Then mint a token per run in both jobs:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ secrets.RELEASE_PLZ_APP_ID }}
private-key: ${{ secrets.RELEASE_PLZ_APP_KEY }}
# ...
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
The same limitation applies to CI on the release pull request: opened with the default token, no checks run on it.
Releasing by hand
Pushing a v* tag still builds and publishes everything — that path never
changed, and it is the fallback if the automation is wedged:
# Set [workspace.package].version, add the CHANGELOG.md section, commit.
git tag v0.3.0 && git push origin v0.3.0
If CHANGELOG.md has no section for the tag, release.yml says so in a warning
annotation and falls back to GitHub's generated "What's Changed" list, so the
release is never left with an empty body.
Why release-plz
The commit convention is already mandated and already followed here, so the
information a changelog needs is in the history and nothing was consuming it. The
alternative — a changeset file per pull request, as pnpm's changesets or
knope do — buys better prose at the cost of a file that is
easy to forget, and here it would mostly restate the subject line.
The cost of deriving it is real, though: the changelog is only as good as the
commit subjects. That is the other reason
.github/workflows/conventions.yml
checks pull request titles — see Commit messages.