Repository navigation
fix(release): rerun bin/release once when the release brings a newer one - #545
Merged
Merged
Conversation
The changelog fold (cli-dev changelog fold --land) fast-forwards main, and so does the version raise through land() where the script has one. sh reads bin/release as it goes, so a newer bin/release on main ran half old, half new. bin/release now hashes itself at start and, after those steps, re-execs ./bin/release with the same arguments if the file changed. WIRECAT_RELEASE_RERUN allows one re-exec; a second change stops with "run it again". The restart uses ./bin/release from the repository root, not "$0", which is wrong after cd when the script was started from another folder by a relative path. The release lock is taken again by the second run. Same fix as WireCatLabs/cli-base#173. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
leemour
force-pushed
the
fix/release-rerun
branch
from
October 16, 2026 17:22
cae2497 to
b26f91a
Compare
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.
Task
Port WireCatLabs/cli-base#173 here.
bin/releasefolds the changelog withcli-dev changelog fold --land. That call fast-forwardsmain, even when it has nothing to fold. If the update changesbin/release, sh goes on reading the file from the byte it had reached, so the rest of the run is a mix of old and new text.What
bin/releasehashes itself at start. After the fold, if the file changed, it re-execs./bin/releasewith the same arguments.WIRECAT_RELEASE_RERUNallows one re-exec. A second change stops the run withbin/release changed again while releasing — run it again../bin/release, relative to the repository root the script has alreadycd'd to, not"$0":$0is wrong aftercdwhen the script was started from another folder by a relative path.execkeeps the PID and the inherited fd 9;wirecat_release_lockreopens fd 9 and callsflockagain.land(), which also fast-forwardsmain.git merge --ff-only origin/mainusedexec "$0"; it now usesexec ./bin/releasetoo.scripts/next-version.mjsreturns the version already raised, soland()is not called again.Testing
sh -n bin/release;pnpm lint,pnpm docs:lint,pnpm standards:check, pluspnpm docs:checkwhere the repository has it. No tests coverbin/release.rerun_if_changedblock andconfig/wirecat/release-lock.shwithflock. The stand-in fold fast-forwards one queued commit, and the run starts fromelsewhere/deeperas../../repo/bin/release --local:bin/releasechanged once: exactly one re-exec,--localreaches the second run, the lock is taken again, and a separateflock -nis refused (exit 75);CHANGELOG.mdchanged: no re-exec;exec "$0"form, same start:exec: ../../d/bin/release: not found, exit 127.🤖 Generated with Claude Code