12. Cut releases with git tags and forge releases, not release-plz
Date: 2026-09-18
Status
Accepted. Supersedes the release automation set up in
0002: Monorepo structure with four crates
and every subsequent .release-plz.toml fix. Closes issue #64.
Relates to 18. Close the platform-promise gap without cargo-dist
Context
ci/woodpecker/push/release failed on every push to main. The failure was:
ERROR failed to determine next versions
Caused by:
0: run cargo package
1: cargo package failed: " Packaging cerebro-core v0.2.2 (.../worktree/crates/cerebro-core)
error: failed to verify manifest at `.../worktree/crates/cerebro-mcp/Cargo.toml`
Caused by:
all dependencies must have a version requirement specified when packaging.
dependency `cerebro-core` does not specify a version"
Issue #64 lists the eight configuration variants tried and discarded on a
clean tree: publish_no_verify, allow_dirty, semver_check = false,
release = false, git_only = false, dropping the version key from
[workspace.dependencies], aligning [workspace.package] version with the
tags, deleting the newest tags. Two release-plz versions, 0.3.159 and 0.3.165,
fail identically.
None of them could work because this isn’t a configuration problem. Every
crate in the workspace is publish = false, and the binaries depend on their
siblings by path:
$ cargo package -p cerebro-mcp
error: failed to prepare local package for uploading
Caused by:
no matching package named `cerebro-core` found
location searched: crates.io index
cerebro-core, cerebro-tui and cerebro-mcp return 404 on crates.io, and
an unrelated crate has taken the name cerebro there. Packaging strips the
path from a dependency and resolves it in a registry, so cargo package
can’t succeed for any crate in this workspace. It never could. release-plz
shells out to cargo package even with git_only = true, which is why the
pipeline goes red and why no knob on it helps. Upstream tracks this as
release-plz#2595 and #2651, with the actual fix in #2789, which hadn’t merged
at the time of writing.
Nobody publishes anything from this workspace. Installation is
cargo install --path crates/cerebro, documented in docs/quick-start.md,
and a release is a git tag plus a forge page someone can read. The tags were
doing that job already:
$ git cat-file -p cerebro-v0.2.3
tag cerebro-v0.2.3
tagger Gitea <gitea@fake.local> 1779942905 +0200
The tagger is the forge, not a person. Creating a release through the API with a tag that doesn’t exist yet makes Codeberg cut the tag itself. So the one release-plz step that worked didn’t need release-plz.
That leaves a tool whose remaining value here is: read conventional commits,
propose a semantic version bump, write a changelog. git-cliff does all three,
and doesn’t need a registry.
Decision
Drop release-plz. A release is two halves with a human and a merge in between.
Local half, just release. scripts/release.sh prepare asks git-cliff for
the next version from the commit types since the last cerebro-v* tag. It
inserts the rendered section into CHANGELOG.md, rewrites
[workspace.package] version, and refreshes Cargo.lock so the resolved
versions move with the manifest. The script commits all three on a
release/cerebro-v<version> branch, prints the push and fj pr create
commands, and touches nothing remote. It refuses a dirty tree and refuses to
re-use a tagged version.
Forge half, CI. .woodpecker/release.yml has one release step, on push to
main: scripts/release.sh publish. It reads the version from Cargo.toml. If
a matching tag exists, the answer is “already released” and exit 0, which is
the normal result of most pushes. Otherwise it takes that version’s
CHANGELOG.md section as the body and posts one release to the forge API,
which creates the tag pointing at the commit CI just built.
There is no crates.io step, and no publish on a tag event: the forge makes
the tag, so a tag-triggered pipeline would be a loop waiting to happen.
cliff.toml owns the section format. [workspace.dependencies] loses the
hand-maintained version = "0.2" ranges on the internal crates. Nobody
packages this workspace, so a path dependency needs no range. That key is what
cargo printed the misleading “does not specify a version” line from.
scripts/release-test.sh drives the script against scratch git repositories
with the forge call stubbed. It covers which line bump rewrites, next
across patch/minor/major/nothing, and whether notes finds one section and
stops at the next. It checks the publish decisions: no-op, publish once, stand
down after the tag exists, refuse without notes, refuse without a token, and
--dry-run sending nothing. It runs in the CI test step and inside
just test.
Consequences
Pros
- The pipeline is green on pushes that aren’t releases, which is most of them.
- Reviewers see a release as a pull request before any tag exists. The old flow had the same shape by accident, but its notes came from a tool that couldn’t verify the tree.
- What CI publishes is the changelog section a human read in the release PR, not a second rendering from a different tool.
- The version in
Cargo.tomland the newest tag can’t drift silently: the tagscerebro-v0.2.2andcerebro-v0.2.3both point at the same commit while the manifest read 0.2.2, and no release page exists for either. - One tool less in the CI image. The release step needs git, curl, and bash.
Cons
- Version bumps are no longer automatic on merge. Someone runs
just release. That’s a deliberate trade: this repo shipped three tags in five months, and the automation meant to cover it has never once run cleanly end to end. - No crates.io presence, so
cargo install cerebrofrom the registry stays unavailable. The registry never had it, and an unrelated crate has the name. - Merging a release PR without its changelog section makes CI red rather than publishing something thin. Loud and self-explanatory, but still red.
- git-cliff is now a required local tool for releasing, where before CI installed it on demand.
Migration
Nothing to do for users. For anyone with a release-plz habit:
just release-status # current version vs. what the commits propose
just release # branch + changelog + bump, one commit, nothing remote
just release-preview # the tag and notes CI would publish, no forge traffic
bash scripts/release-test.sh
The 0.2.2 and 0.2.3 tags stay untouched. Both are older than main, and
rewriting published tags to fix a mismatch is a worse trade than leaving a
pair of releases unannounced. The next just release moves to 0.3.0, which is
what the commits since cerebro-v0.2.3 ask for.
Notes
CEREBRO_RELEASE_TOKENcarries the forge token in CI, from the existingAPI Tokensecret. Locallyrelease.shalso acceptsCODEBERG_ACCESS_TOKEN, whichfjalready uses.- The first release this flow cut, 0.3.0, left
Cargo.lockresolving the workspace at 0.2.2, because nothing refreshed it after the manifest bump.preparenow runscargo metadata --offlineand commits the lock with the manifest and changelog. cargo would have rewritten it on the next build, which is why the disagreement is invisible until someone clones a tag. - The script accepts environment overrides for every path it reads:
CEREBRO_RELEASE_REPO_DIR,CEREBRO_RELEASE_CARGO_TOML,CEREBRO_RELEASE_CHANGELOG,CEREBRO_RELEASE_API,CEREBRO_RELEASE_REPO. The tests need that to point a scratch repo and a stubcurlat the script. - The script doesn’t use
git-cliff --prepend. It re-emits its own header each run, which duplicates the preamble inCHANGELOG.md.prepend_changelogin the script splices the rendered section in before the first existing section, so the preamble belongs to the file. cliff.tomlkeeps git-cliff’sbodytemplate on one line with explicit newlines. With the indented multi-line form, git-cliff 2.14 emits a newline for every loop tag, which renders each bullet as its own one-item list.scripts/release-test.shasserts against that withloose_bullets.- Group names in
cliff.tomlcarry an HTML comment prefix (<!-- 0 -->Features) becausegroup_bysorts keys as strings.striptagsremoves the prefix, and the prefix is what keeps Features before Bug Fixes. build,ci,chore,styleandtestcommits areskip = true. They’re in the history, they’re how the repo works, and they’re not release notes.