Skip to content

fix(release): don't fail the version step on a stale git exit code - #33

Merged
nullfx merged 1 commit into
mainfrom
fix/release-bump-exit-code
Oct 9, 2026
Merged

nullfx merged 1 commit into
mainfrom
fix/release-bump-exit-code

Conversation

@nullfx

@nullfx nullfx commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Fix: release "Increment version" step fails with exit code 1

After #32 merged, release.yml failed at Increment version right after printing RELEASE_VERSION: 1.1.10 -> 1.1.11 (changed=True).

Cause

bump-version.ps1 checks that the new version isn't already tagged by running git rev-parse --verify refs/tags/v1.1.11. When the tag doesn't exist, which is the normal case, git exits 1, and that value stayed in $LASTEXITCODE. GitHub Actions' pwsh wrapper ends every step with exit $LASTEXITCODE, so a successful bump was reported as a failure.

The step failed before the bump was committed, so nothing was pushed, tagged or published. main is still at 1.1.10.

Fix

  • Reset $LASTEXITCODE after the tag lookups.
  • End bump-version.ps1 and verify-package.ps1 with an explicit exit 0. Real errors still fail the step through throw.

The versioning model is unchanged. Directory.Build.props holds the currently published version. On merge to main, the release reads it, increments it, builds, packs and publishes, and pushes the new value back to main.

Validation

Each case was run the way Actions runs it (pwsh -command ". '<step>'" plus the appended exit $LASTEXITCODE):

Case Exit code
Merge to main: 1.1.10 is tagged → bump to 1.1.11 0
Re-run after a failed release: 1.1.11 not tagged yet → released as-is, no double bump 0
New version already tagged → error 1 (expected)
verify-package.ps1 on a 1.1.11 package 0

After merge

Merging this PR triggers release.yml, which should release v1.1.11.


🤖 Generated with Claude Code

https://claude.ai/code/session_012C6aJYkYBV2GSnSZwsd9GU

bump-version.ps1 checks that the new version isn't already tagged with
'git rev-parse --verify refs/tags/vX.Y.Z'. When the tag doesn't exist
(the normal case) git exits 1, and that value was left in $LASTEXITCODE.
GitHub Actions' pwsh wrapper ends each step with 'exit $LASTEXITCODE',
so the "Increment version" step failed right after computing
1.1.10 -> 1.1.11. Nothing was committed or published.

- Reset $LASTEXITCODE after the tag lookups in Test-Released.
- End bump-version.ps1 and verify-package.ps1 with an explicit exit 0;
  real failures still surface through 'throw'.

Verified under the Actions wrapper (pwsh -command ". '<step>'" plus the
appended LASTEXITCODE check): patch bump exits 0, a re-run with an
untagged version exits 0 without bumping, a tag collision still exits 1,
and package verification exits 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012C6aJYkYBV2GSnSZwsd9GU
@nullfx
nullfx merged commit 372ba9d into main Oct 9, 2026
4 checks passed
@nullfx
nullfx deleted the fix/release-bump-exit-code branch October 9, 2026 11:10
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.

2 participants