Harden release workflow: idempotent publishing, fix version-drift root cause - #8
Open
AadhilFarhan wants to merge 1 commit into
Open
Harden release workflow: idempotent publishing, fix version-drift root cause#8AadhilFarhan wants to merge 1 commit into
AadhilFarhan wants to merge 1 commit into
Conversation
…t cause - gh release create has no recovery path if a release for the tag already exists — a retry after any mid-job failure (e.g. the tap update step erroring) hard-fails immediately instead of finishing the job. Now checks for an existing release first and falls back to gh release upload --clobber to overwrite assets, rather than trying to create a duplicate. - Support/Info.plist's committed CFBundleShortVersionString could silently drift from reality: CI's PlistBuddy stamp only mutated the ephemeral runner checkout and was never committed back, and a local build-app.sh run had no version logic at all, so it always baked in whatever the last-committed value happened to be. build-app.sh now derives the version itself via git describe --tags --exact-match at build time and stamps the bundle's copy of Info.plist directly — the same logic runs for both a CI release build (which lands on the tag's exact commit) and a local build, and an untagged local build gets an unambiguous "0.0.0-dev" instead of a stale-looking release number. The separate CI-only stamp step is now redundant and removed. Verified build-app.sh's version derivation directly: at the v0.1.0 tag's own commit it resolves to "0.1.0"; at a later, untagged commit it correctly falls back to "0.0.0-dev" without aborting under set -euo pipefail. Also rebuilt the app end-to-end and confirmed the bundled Info.plist's CFBundleShortVersionString matches.
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.
What
Two gaps flagged by review that a single successful release run wouldn't have exercised:
Non-idempotent release creation.
gh release createhas no recovery path if a release for the tag already exists — a retry after any mid-job failure (say, the tap-update step erroring) hard-fails immediately instead of finishing. Now checks for an existing release first (gh release view) and falls back togh release upload --clobberto overwrite assets, instead of trying to create a duplicate.Version-drift risk, fixed at the root rather than documented around.
Support/Info.plist's committedCFBundleShortVersionStringcould silently drift from reality: CI'sPlistBuddystamp only mutated the ephemeral runner checkout and was never committed back, and a localbuild-app.shrun had no version logic at all — it always baked in whatever the last-committed value happened to be, release or not.build-app.shnow derives the version itself viagit describe --tags --exact-matchat build time and stamps the bundle's copy ofInfo.plist— the same logic runs for a CI release build (which lands exactly on the tag's commit) and a local dev build alike, and an untagged local build now gets an unambiguous0.0.0-devinstead of a stale-looking release number. The separate CI-only stamp step is now redundant and removed.One assumption I'm relying on but couldn't fully verify in this session: that
actions/checkout@v4preserves the local tag ref for a tag-triggered workflow, whichgit describe --tags --exact-matchneeds. This is a standard, widely-used pattern for exactly this purpose, but worth confirming on the next real tagged release rather than taking on faith.Test plan
v0.1.0tag's own commit it resolves to0.1.0; at a later, untagged commit (an already-pushed fix branch) it correctly falls back to0.0.0-devwithout aborting underset -euo pipefail.Info.plist'sCFBundleShortVersionStringmatches (0.1.0, since this branch's HEAD is currently the same commit as thev0.1.0tag).release.yml, since that requires pushing a tag — flagged for you to confirm on the next real release rather than done unbidden.