Skip to content

Commit b93df76

Browse files
committed
Auto-derive version and build number from git tag
Previously, version numbers had to be manually updated in four places in the Xcode project before each release, which was error-prone and often got out of sync with git tags. Now the archive scripts automatically set: - MARKETING_VERSION from git tag (v0.0.8 → 0.0.8) - CURRENT_PROJECT_VERSION from git commit count (unique per build) The git tag is now the single source of truth for versioning.
1 parent 16146df commit b93df76

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
77
### Changed
88
- Release scripts now use shared `config.sh` for app name and paths
99
- `just release` no longer waits for notarization (async workflow)
10+
- Version and build number now auto-derived from git tag and commit count
1011

1112
## [v0.0.8] - 2026-01-07
1213

RELEASE.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,15 @@ Both require the private key to be present.
205205

206206
Before releasing a new version:
207207

208-
1. [ ] Update version in Xcode (both targets)
209-
2. [ ] Update `CHANGELOG.md`
210-
3. [ ] Create git tag: `git tag v0.0.X`
211-
4. [ ] Push tag: `git push origin v0.0.X`
212-
5. [ ] Build releases:
208+
1. [ ] Update `CHANGELOG.md`
209+
2. [ ] Create git tag: `git tag v0.0.X`
210+
3. [ ] Push tag: `git push origin v0.0.X`
211+
4. [ ] Build releases:
213212
- [ ] `just release v0.0.X` (direct)
214213
- [ ] `just dmg v0.0.X` (optional DMG installer)
215214
- [ ] `just release-appstore v0.0.X` (App Store)
216-
6. [ ] Create GitHub release with `.zip` (and optionally `.dmg`)
217-
7. [ ] Submit App Store version in App Store Connect
215+
5. [ ] Create GitHub release with `.zip` (and optionally `.dmg`)
216+
6. [ ] Submit App Store version in App Store Connect
217+
218+
> **Note:** Version and build number are automatically set from the git tag.
219+
> `v0.0.8` → MARKETING_VERSION=0.0.8, BUILD=(commit count)

scripts/archive-appstore.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ trap cleanup EXIT
3737

3838
echo "Building for App Store: $ver"
3939

40+
# Derive marketing version and build number from git
41+
marketing_version="${ver#v}" # v0.0.8 → 0.0.8
42+
build_number=$(git rev-list --count HEAD)
43+
44+
echo "Setting MARKETING_VERSION=$marketing_version, BUILD=$build_number"
45+
46+
# Update Xcode project with version info
47+
project_file="$PROJECT/project.pbxproj"
48+
sed -i '' "s/MARKETING_VERSION = [^;]*;/MARKETING_VERSION = $marketing_version;/g" "$project_file"
49+
sed -i '' "s/CURRENT_PROJECT_VERSION = [^;]*;/CURRENT_PROJECT_VERSION = $build_number;/g" "$project_file"
50+
4051
ver_dir="$BUILD_DIR/$ver-appstore"
4152
archive_path="$ver_dir/CacheStatus.xcarchive"
4253
export_path="$ver_dir/export"

scripts/archive.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ trap cleanup EXIT
3838

3939
echo "Building version: $ver"
4040

41+
# Derive marketing version and build number from git
42+
marketing_version="${ver#v}" # v0.0.8 → 0.0.8
43+
build_number=$(git rev-list --count HEAD)
44+
45+
echo "Setting MARKETING_VERSION=$marketing_version, BUILD=$build_number"
46+
47+
# Update Xcode project with version info
48+
project_file="$PROJECT/project.pbxproj"
49+
sed -i '' "s/MARKETING_VERSION = [^;]*;/MARKETING_VERSION = $marketing_version;/g" "$project_file"
50+
sed -i '' "s/CURRENT_PROJECT_VERSION = [^;]*;/CURRENT_PROJECT_VERSION = $build_number;/g" "$project_file"
51+
4152
ver_dir="$BUILD_DIR/$ver"
4253
archive_path="$ver_dir/CacheStatus.xcarchive"
4354
export_path="$ver_dir/export"

0 commit comments

Comments
 (0)