Skip to content

ci: add release-v3 PR-based release workflow (release-please) - #88

Merged
kayibal merged 3 commits into
mainfrom
ci/release-v3-pr-flow
Jul 14, 2026
Merged

kayibal merged 3 commits into
mainfrom
ci/release-v3-pr-flow

Conversation

@kayibal

@kayibal kayibal commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Reusable release workflow that opens a release PR for human review instead of pushing the version bump to main. Built on release-please.

Behaviour

release-please handles both phases in one run (triggered by the caller's push to main):

  • normal push → creates/updates the release PR (version bump + Cargo.toml/Cargo.lock + CHANGELOG, from Conventional Commits)
  • release PR merged → creates the tag + GitHub Release, which triggers each repo's existing release: published publish workflows (crates.io, npm, binaries, images)

Why release-please over semantic-release

release-v2 pushes the release commit straight to main via @semantic-release/git, which requires the App to bypass the main-branch ruleset. Forcing semantic-release into a PR model needs fragile glue (dry-run parsing, config extraction, hand-rolled tag creation). release-please is built for the PR model: it maintains the PR natively, keeps it updated as commits land, and only tags on merge.

Token handling

  • App token is repo-scoped (default) and limited to contents + pull-requests + issues write.
  • release-please edits manifests/lockfiles directly — no cargo/npm build runs, so no dependency build.rs/install script executes during a release and the token is never exposed to one.
  • The App token (not the default GITHUB_TOKEN) is required so the release PR gets CI and the published release triggers downstream workflows.
  • The token only manages the release PR and creates the tag/Release — it never commits to main, so the App can be dropped from the ruleset bypass.

Requires

  • The App needs issues: write added (currently missing) for release-please label management.
  • Each consumer repo adds release-please-config.json + .release-please-manifest.json (replacing release.config.js), using release-type: rust + the cargo-workspace plugin (updates Cargo.lock) and include-v-in-tags: false (keeps bare version tags).

Behavioural deltas vs semantic-release (agreed)

  • refactor/security/style commits no longer trigger a release on their own (only feat/fix/breaking do).
  • Breaking changes use feat!: / BREAKING CHANGE: rather than a breaking: type.

Not yet exercised end-to-end; token-quoter is the planned first cutover / validation.

🤖 Generated with Claude Code

kayibal and others added 3 commits July 14, 2026 13:44
release-v3 replaces the direct-to-main release model of release-v2. Instead of
semantic-release pushing the version bump + CHANGELOG to main (which requires the
App to bypass branch protection), v3 opens a release PR for human review.

Phase A (normal push to main): compute the next version via semantic-release
--dry-run, close any stale open release PR (label: autorelease) and delete its
branch, recreate the bump + CHANGELOG on an autorelease/v<version> branch reusing
the repo's own prepareCmd, and open a fresh release PR.

Phase B (release PR merged): create the tag + GitHub Release, triggering the
repo's existing release:published publish workflows.

The App token only pushes to autorelease/* branches and manages PRs — it never
commits to main — so the App can be removed from the main-branch ruleset bypass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Harden the App token handling in release-v3:

- Scope the minted token to this repository (create-github-app-token default) and
  to the minimum permissions (contents + pull-requests write) via permission-* inputs.
- Mint the token only after all repository/dependency code (semantic-release, cargo,
  npm) has run, and expose it solely to the git-push / PR / release steps.
- Run the version compute (dry-run) under the default GITHUB_TOKEN, and the bump under
  no token at all.
- checkout with persist-credentials: false so no token is left on disk during a build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the semantic-release + hand-rolled prepare/publish glue with a thin
release-please wrapper. release-please natively opens and maintains the release PR,
bumps Cargo.toml + Cargo.lock (via the cargo-workspace plugin) and the CHANGELOG, and
on merge creates the tag + GitHub Release that triggers the existing publish workflows.

It edits manifests directly (no cargo/npm build), so no repository code runs during a
release and the App token is never exposed to a build script. The token is repo-scoped
and limited to contents + pull-requests + issues write.

Each consumer supplies release-please-config.json and .release-please-manifest.json.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@kayibal kayibal changed the title ci: add release-v3 PR-based release workflow ci: add release-v3 PR-based release workflow (release-please) Jul 14, 2026
@kayibal
kayibal merged commit e61cdd8 into main Jul 14, 2026
3 checks passed
@kayibal
kayibal deleted the ci/release-v3-pr-flow branch July 14, 2026 16:42
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