Auto-number builds from git history at build time#80
Open
MattFaz wants to merge 2 commits into
Open
Conversation
Adds a Stamp Build Number script phase to the app target: CFBundleVersion is set to 100 + commit count in the built product, so archives number themselves and PRs never touch CURRENT_PROJECT_VERSION again (it stays as the fallback when git is unavailable). The +100 base keeps the sequence above the last manually numbered build (82). Archive from main so the count only moves forward. Script sandboxing is disabled on the app target only, since the phase writes the processed Info.plist in the build directory.
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.
Summary
Removes manual build-number management: a Stamp Build Number run-script phase on the app target sets
CFBundleVersionto 100 + git commit count in the built product. Every archive numbers itself, PRs never touchCURRENT_PROJECT_VERSIONagain (no more pbxproj bump conflicts), and the sequence can only move forward as long as archives come frommain.Details
CURRENT_PROJECT_VERSIONstays in the project as the fallback when git is unavailable — the script only overrides the plist whengit rev-list --count HEADsucceeds.ENABLE_USER_SCRIPT_SANDBOXING = NOon the app target only (tests keep the project-level default) — the phase writes the processed Info.plist in the build dir, which the sandbox would block.Verification
Built for simulator at commit count 60:
CFBundleVersionin the built app = 160.plutil -lintandxcodebuild -listconfirm the project file stays valid.Note for #79
#79 manually bumps to 82 — that's fine as the last manual number. Whichever PR merges second may see a trivial pbxproj merge; the changes don't overlap line-wise.