Skip to content

Fail the release when Cargo.toml does not match the tag - #77

Merged
nnmarcoo merged 1 commit into
mainfrom
release-version-guard
Aug 22, 2026
Merged

Fail the release when Cargo.toml does not match the tag#77
nnmarcoo merged 1 commit into
mainfrom
release-version-guard

Conversation

@nnmarcoo

Copy link
Copy Markdown
Owner

Closes #49.

Two things read a version and they disagree. cargo-wix stamps the MSI ProductVersion from Cargo.toml. The macOS bundle takes CFBundleShortVersionString from the git tag. Nothing checked that they agree, so tagging without bumping Cargo.toml gives a DMG with the right number and an MSI with the old one.

The MSI half is the part that lasts. Windows Installer decides upgrades on ProductVersion, so two releases both stamped 0.1.0 mean MajorUpgrade never fires and the second install does not replace the first. That cannot be repaired after the fact, since the broken installer is already on disk.

This adds a version job that build depends on. It compares the tag with the [package] version and fails with the two values in the error if they differ.

Behaviour I checked locally against the current manifest at 0.1.0:

ref result
branch main (workflow_dispatch) skips, exit 0
tag v0.1.0 passes
tag v0.5.0 fails, names both versions
tag v1.0.0-rc.1 fails, names both versions

Prerelease tags work because the guard strips only the leading v, so v1.0.0-rc.1 wants version = "1.0.0-rc.1", which is valid semver.

This does not bump anything. It only stops a release that would ship mismatched artifacts, so the first tag still needs Cargo.toml set to match by hand.

cargo-wix stamps the MSI ProductVersion from Cargo.toml, while the macOS
bundle takes CFBundleShortVersionString from the tag. Nothing held the
two together, so a forgotten bump produced a release whose installer
Windows would not treat as an upgrade over the previous one.

The new job runs before build and is a no-op on workflow_dispatch, where
there is no tag to compare against.
@nnmarcoo
nnmarcoo merged commit f114b25 into main Aug 22, 2026
1 check passed
@nnmarcoo
nnmarcoo deleted the release-version-guard branch August 22, 2026 14:47
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.

Nothing syncs Cargo.toml version with the release tag

1 participant