Skip to content

Auto-number builds from git history at build time#80

Open
MattFaz wants to merge 2 commits into
mainfrom
auto-build-number
Open

Auto-number builds from git history at build time#80
MattFaz wants to merge 2 commits into
mainfrom
auto-build-number

Conversation

@MattFaz

@MattFaz MattFaz commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

Removes manual build-number management: a Stamp Build Number run-script phase on the app target sets CFBundleVersion to 100 + git commit count in the built product. Every archive numbers itself, PRs never touch CURRENT_PROJECT_VERSION again (no more pbxproj bump conflicts), and the sequence can only move forward as long as archives come from main.

Details

  • CURRENT_PROJECT_VERSION stays in the project as the fallback when git is unavailable — the script only overrides the plist when git rev-list --count HEAD succeeds.
  • The +100 base gives permanent headroom above the last manually numbered build (82); the first auto-numbered archive from main will be ~161.
  • ENABLE_USER_SCRIPT_SANDBOXING = NO on 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.
  • Debug builds get stamped too, so Settings → Version shows the real number during development.

Verification

Built for simulator at commit count 60: CFBundleVersion in the built app = 160. plutil -lint and xcodebuild -list confirm 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.

MattFaz added 2 commits July 20, 2026 10:08
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.
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.

1 participant