ci: auto-release on version bump + PR changelog guard#2
Merged
Conversation
Release.yml now triggers on pushes to main (in addition to v* tags and manual dispatch). A new gate job reads the Cargo.toml version, and if no matching v<version> tag exists, creates the tag and runs build/release/ crates in the same run. Doing it in one workflow avoids the GITHUB_TOKEN limitation where a token-pushed tag won't trigger a separate workflow, so no PAT is needed. Tag-push and workflow_dispatch flows still work. CI gains a PR-only changelog job: when a PR bumps the Cargo.toml version, it must add a matching '## [<version>]' CHANGELOG.md section or the check fails. It is gated on pull_request events so it never blocks main.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two basic things here:
AI Summary
Merging a PR that bumps the
Cargo.tomlversion didn't cut a release, becauserelease.ymlonly fired on a pushedv*tag. This wires releases to the package version and adds a guard so version bumps stay in sync with the changelog.Release: auto-cut on version bump (
release.yml)main(still supportsv*tag pushes andworkflow_dispatch).gatejob readsversionfromCargo.toml, computesv<version>, and:should_release=true;should_release=false(no-op).build/release/cratesnowneeds: gateand run only whenshould_release == 'true', usingneeds.gate.outputs.taginstead ofgithub.ref_name.Everything happens in one workflow run, which sidesteps the GitHub rule that a tag pushed with the default
GITHUB_TOKENwon't trigger a separate workflow — so no PAT is required.CI: PR-only changelog guard (
ci.yml)changelogjob gated onpull_requestevents (never runs onmain, so it can't block the release flow).Cargo.tomlversion, it must add a matching## [<version>]section toCHANGELOG.md, or the check fails with an annotation. PRs that don't touch the version pass untouched.Requirements
CARGO_REGISTRY_TOKENsecret (already used by thecratesjob).contents: write, already requested bygate).