Skip to content

release.yml: fail fast if the pushed tag doesn't match Cargo.toml's version - #561

Merged
brawer merged 1 commit into
mainfrom
release-verify-tag-version
Aug 9, 2026
Merged

release.yml: fail fast if the pushed tag doesn't match Cargo.toml's version#561
brawer merged 1 commit into
mainfrom
release-verify-tag-version

Conversation

@brawer

@brawer brawer commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Follow-up from the release-process review.

Nothing verified that the git tag triggering a release (e.g. `v1.2.3`) actually matches `Cargo.toml`'s package version. A mismatched tag would still build, push, and attest a full release -- the registry tag would just disagree with what the binary and SBOM internally report as their own version, discovered only after the fact (if at all).

Adds a `verify-version` job that runs before the expensive (~11-16 min per arch) `build` job and fails immediately with a clear error message on a mismatch, instead of burning CI time on a release that would have to be thrown away anyway. `build` now `needs: [verify-version]`.

Extracts the version with a small `awk` script scoped specifically to the `[package]` section, not a bare `version = ` grep -- dependency entries also contain `version = ...` fields, so scoping to `[package]` means those can never cause a false match regardless of where they appear in the file. Verified against the current `Cargo.toml`, both the matching and mismatching cases.

(`cargo metadata` would also work, but this repo pins an exact Rust toolchain via `rust-toolchain.toml`, so running any `cargo` subcommand here would make rustup download and install that whole toolchain first just to read one string -- not worth it for what should be a near-instant pre-flight check.)

🤖 Generated with Claude Code

…ersion

Nothing verified that the git tag triggering a release (e.g. "v1.2.3")
actually matches Cargo.toml's package version. A mismatched tag would
still build, push, and attest a full release -- the registry tag would
just disagree with what the binary and SBOM internally report as their
own version, discovered only after the fact (if at all).

Add a verify-version job that runs before the (expensive, ~11-16 min
per arch) build job and fails immediately with a clear message on a
mismatch, instead of burning CI time on a release that has to be
thrown away anyway. build now depends on it via needs:.

Extracts the version with a small awk script scoped to the [package]
section specifically (not a bare "version = " grep), since dependency
entries can also contain "version = ..." fields --  scoping to
[package] means those can never cause a false match regardless of
where they appear in the file. Verified against the current
Cargo.toml, both the matching and mismatching cases.

cargo metadata would also work, but this repo pins an exact Rust
toolchain via rust-toolchain.toml, so running any `cargo` subcommand
here would make rustup download and install that whole toolchain
first, just to read one string -- not worth it for what should be an
near-instant pre-flight check.
@brawer
brawer enabled auto-merge August 9, 2026 16:05
@brawer
brawer added this pull request to the merge queue Aug 9, 2026
Merged via the queue into main with commit 5693936 Aug 9, 2026
4 checks passed
@brawer
brawer deleted the release-verify-tag-version branch August 9, 2026 16:09
@brawer brawer added the bug Something isn't working label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant