Skip to content

feat(release): a git-cliff changelog and the rc/* release-candidate bot - #178

Merged
aRustyDev merged 2 commits into
mainfrom
feat/release-changelog
Nov 15, 2026
Merged

aRustyDev merged 2 commits into
mainfrom
feat/release-changelog

Conversation

@aRustyDev

Copy link
Copy Markdown
Owner

What

PR 1 of the CI/CD plan (.agents/plans/cicd-review/PLAN.md, in #177): the git-cliff changelog and the bot that keeps the release-candidate branch.

After every push to main, the new release-pr.yml keeps one branch, rc/vX.Y.Z. That branch is main plus a single commit, chore(release): vX.Y.Z. The commit writes:

  • CHANGELOG.md;
  • the version in [workspace.package];
  • the workspace packages' versions in Cargo.lock.

The bot also keeps one pull request from that branch to main. Merging that pull request is the release.

Piece Does
cliff.toml Lists features, fixes, performance work, refactors, reverts and breaking changes. Only a listed commit makes a release, so a docs-only merge does nothing. The first version is v0.1.0. In 0.x, a feature or a breaking change bumps the minor version.
.github/scripts/release-pr.sh prepare Holds no secret. Decides whether to release and which version, writes the three files, and computes the tree locally.
.github/scripts/release-pr.sh publish Posts the tree with the release App's token and stops unless GitHub's tree matches the local one. Commits through the API, so GitHub signs the commit. Force-updates the branch, opens or updates the PR, then closes and deletes rc/* branches of superseded versions.
.github/workflows/release-pr.yml Splits the work into two jobs, prepare and publish. publish stays skipped until the repository variable RELEASE_APP_CLIENT_ID is set.

Design points:

  • The changelog only grows. The new section is prepended to main's CHANGELOG.md and never regenerated.
  • The date comes from main's head commit (UTC). git-cliff would stamp an untagged section with today's date (I checked this). The same main would then make a different branch tomorrow.
  • It skips when:
    • the head commit is itself a release;
    • the last merged release has no tag yet;
    • nothing releasable has landed since the last tag.
  • It uses the App's token, not GITHUB_TOKEN. A branch pushed with GITHUB_TOKEN starts no workflow, so neither ci nor the staging deploy (PR 2) would run on it.

Tests

  • test-release-pr.sh (122 checks, in ci-scripts):
    • Walks a release's life in a real repository with a bare origin, using the repository's own cliff.toml and a real git-cliff.
    • Checks publish's API calls, their order, and the bytes it sends, against a fake gh.
    • Checks that ci.yml and release-pr.yml pin the same git-cliff version (2.14.2).
  • 21 hand-made mutants of the script were each caught. The first run had 4 survivors, and each one led to a new test case.
  • Run on the real history, prepare gives v0.1.0: 75 listed commits (55 features, 11 fixes, 9 refactors).
  • Lockfile check: cargo metadata --locked --offline accepts the rewritten Cargo.toml and Cargo.lock. The control, an updated Cargo.toml with the old lockfile, fails with exit 101.
  • Locally, all green:
    • every ci-scripts test under dash;
    • every deps guard that does not build;
    • lint-workflow.sh (its control fails as expected without SECRET_JOBS=publish);
    • actionlint.
  • classify-changes.sh: a change to cliff.toml alone now runs the Rust set, so the bot's test runs. Three cases were added for it.

Owner steps before it goes live (also in cicd.md, "Release candidates")

  1. Create a GitHub App with no webhook. Give it Contents and Pull requests read/write, and install it on this repository only.
  2. Create the environment release, limited to main, with the secret RELEASE_APP_PRIVATE_KEY.
  3. Set the repository variable RELEASE_APP_CLIENT_ID. Do this after step 2: GitHub creates an unprotected environment when a job names one that doesn't exist.
  4. Add an rc/* ruleset with the App and admins as the only bypass actors.

Don't merge an rc/* PR until PR 3 (the release workflow) lands. Nothing would tag the merge.

Refs: #49

🤖 Generated with Claude Code

aRustyDev and others added 2 commits November 15, 2026 00:09
After every push to main, release-pr.yml keeps one branch, rc/vX.Y.Z,
equal to main plus a single commit `chore(release): vX.Y.Z` that writes
CHANGELOG.md, the [workspace.package] version and the workspace
packages' versions in Cargo.lock, and one pull request from it to main.

- cliff.toml: features, fixes, performance, refactors, reverts and
  breaking changes are listed, and only a listed commit makes a release,
  so a docs-only merge does nothing. First version v0.1.0; in 0.x a
  feature or a breaking change bumps the minor.
- The new section is prepended to main's CHANGELOG.md, never
  regenerated, and dated by main's head commit (git-cliff would date it
  today, so the same main would make a different branch tomorrow).
- prepare holds no secret and computes the tree locally; publish posts
  it with the release App's token and refuses unless GitHub's tree
  matches, commits through the API (signed by GitHub), moves the branch,
  opens or updates the PR, and removes superseded rc/* branches. A push
  with GITHUB_TOKEN would start no workflow on the branch.
- It skips when the head is a release, when the last merged release is
  untagged, or when nothing is releasable. publish stays off until the
  repository variable RELEASE_APP_CLIENT_ID is set.
- test-release-pr.sh (122 checks) walks a release's life with a real
  git-cliff and checks publish against a fake gh; 21 hand mutants of the
  script were each caught. classify-changes.sh treats cliff.toml as a
  change that runs the Rust set, so its test runs.

Refs: #49
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@aRustyDev
aRustyDev merged commit 6753c51 into main Nov 15, 2026
36 checks passed
aRustyDev added a commit that referenced this pull request Nov 15, 2026
…written bot (#183)

The owner's rule: use an existing public solution wherever one does the
job, and hand-write only where none reliably does. #178's bot was
hand-written around git-cliff; release-plz (0.4.3, through
release-plz/action v0.5.148) does the release-candidate pull request, the
version in Cargo.toml and Cargo.lock, CHANGELOG.md, the tag and the
GitHub release.

- Remove cliff.toml, release-pr.yml, release-pr.sh and its test.
- release-plz.toml: git_only; every crate in one version_group; one tag
  and release, v{{ version }}, made for thrust-core, with git_tag_name
  set for the whole workspace (set only on thrust-core, the other crates
  looked for tags of their own and re-released all of history); one
  root CHANGELOG.md; release_always = false with pr_branch_prefix "rc/"
  (the source matches the configured prefix; the docs still say
  release-plz-); release_commits for fixes, features, performance,
  refactors, reverts and breaking changes; a feature bumps the minor in
  0.x. Branches are rc/<timestamp>: release-plz takes only a prefix.
- release-plz.yml: the release and release-pr jobs, as the release
  GitHub App, skipped until RELEASE_APP_CLIENT_ID is set.
- check-release-plz.py, the one hand-written piece: release-plz has no
  workspace-level version group and does not check that every crate is
  listed. Run by deps, tested in ci-scripts (71 checks, 9 of 9 hand
  mutants caught); release-plz.toml alone now runs the Rust set.
- The workspace version is 0.1.0, so the first release is v0.1.0
  (release-plz releases an untagged package at the version it holds).
- Each setting checked with release-plz 0.4.3 on a copy of main: the
  first release, nothing right after the tag, a fix (0.1.1, one
  Cargo.toml line, cargo metadata --locked passes), a feature and a
  breaking chore (0.2.0), test/docs commits and a web/-only fix
  (nothing). A change outside the crates is released by hand, as
  cicd.md describes; release-plz set-version is not the tool (it writes
  the one crate's own version).

Refs: #49

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant