chore(release): automate the version and changelog surgery with cargo-release #329
No reviewers
Labels
No labels
area/ci-release
area/cli
area/docs
area/dungeon
area/ftl
area/graphics
area/gui
area/music
area/saves
area/tooling
port/amiga
port/dos
port/fm-towns
port/mac
port/pc98
port/sega-cd
priority/high
priority/low
priority/medium
type/bug
type/chore
type/docs
type/feature
type/research
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jqueuniet/dm2-tools!329
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "chore/cargo-release"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The mechanical half of a release was four hand edits, each with a trap the docs
had to warn about:
[workspace.package], nine inter-crate requirements,bindings/python/pyproject.toml(whichcargo set-versioncannot reach — itsomission is what shipped a 0.2.0 wheel disagreeing with its own library), then
retitling the changelog section, opening a fresh one, and rewriting two link
references.
cargo release <version>now does all of it, dry-run by default:Configured not to tag, push or publish — tagging triggers the workflow that
publishes to three registries, so it stays a separate deliberate act after the
prepare commit has been reviewed. Changelog entries stay hand-written; only
the surgery is automated.
Two things the dry run turned up
pre-release-replacementsresolves paths per-member. At workspace level itwent looking for
crates/dm2-binrw/CHANGELOG.mdand failed. The replacementstherefore sit on
dm2-cliwith../../paths, where they run once.{{tag_name}}is not available to replacements. Used there it lands in thefile literally, behind a
[WARN] Unrendered {{tag_name}}line that is easy tomiss — the first run wrote
compare/{{tag_name}}...HEADinto the changelog. Thelink references use
v{{version}}instead.Verification
Run for real against a throwaway clone, not just previewed:
Cargo.toml,Cargo.lock,bindings/python/pyproject.tomlandCHANGELOG.mdcargo-release updates
[workspace.dependencies]itself, socargo set-versionis no longer needed
0.2.1: fresh empty
[Unreleased], the entries under## [0.2.2] - <date>,[Unreleased]rebased and a new[0.2.2]reference addedcargo release configconfirmspublish = false,tag = false,push = falseare in effect
The two
<!-- next-header -->/<!-- next-url -->comments added toCHANGELOG.mdare what the replacements anchor on;exactly = 1makes theirremoval an error rather than a silent no-op.
cargo-release is packaged in nixpkgs (1.1.3).
The mechanical half of a release was four hand edits with a documented trap in each: bump `[workspace.package]`, bump nine inter-crate requirements, bump `bindings/python/pyproject.toml` — which `cargo set-version` cannot reach, and whose omission shipped a 0.2.0 wheel disagreeing with its own library — and then retitle the changelog section, open a fresh one and rewrite two link references. `cargo release <version>` now does all of it, dry-run by default. It is configured not to tag, push or publish. Tagging triggers the workflow that publishes to three registries, so it stays a separate act after the prepare commit has been reviewed. Two details the dry run turned up rather than the documentation: `pre-release-replacements` is inherited by every workspace member and its paths resolve against that member's directory, so a workspace-level entry goes looking for `crates/dm2-binrw/CHANGELOG.md`. The replacements therefore sit on dm2-cli with `../../` paths, and run once. `{{tag_name}}` is not available to replacements. Used there it is written into the file literally, behind a warning that is easy to miss in the output — so the link references use `v{{version}}`. Verified by running it for real against a throwaway clone: the commit touches exactly Cargo.toml, Cargo.lock, pyproject.toml and CHANGELOG.md; all ten version references move; no tag and no push; and the resulting changelog matches what was written by hand for 0.2.1.