Skip to content

Commit 71ccdfd

Browse files
authored
fix: SwiftBuddy app version permanently stuck at 1.0 (build 1) (#162)
* fix: SwiftBuddy app version permanently stuck at 1.0 (build 1) generate_xcodeproj.py regenerates project.pbxproj fresh on every build (it's gitignored, not a checked-in file), and MARKETING_VERSION/ CURRENT_PROJECT_VERSION were hardcoded literals in its template. Neither release.yml (which releases roughly daily, tagged bNNN by commit count) nor build-dmg.yml ever touched them, so every DMG and app bundle ever built — regardless of commit or release tag — reported itself as "SwiftBuddy 1.0" build "1". scripts/build_dmg.sh already reads the real CFBundleShortVersionString out of the built app for the DMG filename, so this was silently naming every DMG SwiftBuddy-macOS-v1.0.dmg too. Makes both values overridable via env var (SWIFTBUDDY_MARKETING_VERSION, SWIFTBUDDY_BUILD_NUMBER), defaulting to the previous hardcoded values when unset so local/manual `python3 generate_xcodeproj.py` runs are unaffected. release.yml and build-dmg.yml now set: - build number = `git rev-list --count HEAD`, the same counter release.yml already uses for its bNNN release tags, so the app's build number and its release tag always agree. - marketing version = build date (YYYY.MM.DD) — always distinct per day, no manual "when do we bump this" decision needed for a pipeline that releases on close to a daily cadence. build-dmg.yml's checkout also gained fetch-depth: 0 — needed for `git rev-list --count HEAD` to see full history (it was a shallow clone; release.yml already had this for the same reason). Verified locally: `python3 generate_xcodeproj.py` with no env vars set reproduces the exact previous hardcoded output (1.0/1); with SWIFTBUDDY_MARKETING_VERSION/SWIFTBUDDY_BUILD_NUMBER set, both interpolate correctly into the generated project.pbxproj. * fix: release notes hardcode a DMG filename that no longer matches the actual file Now that the DMG is versioned (SwiftBuddy-macOS-v<date>.dmg, from the previous commit), the release notes' 'Download the attached SwiftBuddy-macOS.dmg below!' line is wrong on every release — the attached file's actual name now changes daily. The upload step itself uses a glob (output/*.dmg) so the upload was never broken, only the prose pointing at a specific filename. Matches the wording the Quick Start section two lines down already uses ('Download the attached DMG and open it') rather than trying to thread the shell-local SWIFTBUDDY_MARKETING_VERSION value into a step that has no access to it.
1 parent 28344ee commit 71ccdfd

3 files changed

Lines changed: 39 additions & 5 deletions

File tree

.github/workflows/build-dmg.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ jobs:
1818
uses: actions/checkout@v4
1919
with:
2020
submodules: recursive
21+
fetch-depth: 0 # Full history — needed for `git rev-list --count HEAD` (build number)
2122

2223
- name: Generate Xcode Project
2324
run: |
25+
# See generate_xcodeproj.py's header comment: without these, every
26+
# build reports the same hardcoded 1.0/1 app version. Matches
27+
# release.yml's scheme so ad-hoc and release builds are consistent.
28+
export SWIFTBUDDY_MARKETING_VERSION="$(date -u +%Y.%m.%d)"
29+
export SWIFTBUDDY_BUILD_NUMBER="$(git rev-list --count HEAD)"
2430
cd SwiftBuddy && python3 generate_xcodeproj.py
2531
2632
- name: Build Ad-Hoc App

.github/workflows/release.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,17 @@ jobs:
140140
141141
- name: Build macOS DMG Wrapper
142142
run: |
143+
# Previously hardcoded 1.0/1 inside generate_xcodeproj.py, so every
144+
# release ever built reported the same app version regardless of
145+
# which commit produced it. SWIFTBUDDY_BUILD_NUMBER reuses the same
146+
# `git rev-list --count HEAD` counter this workflow's bNNN release
147+
# tags already use (step "Determine tag name" above), so the app's
148+
# build number and its release tag always agree. Marketing version
149+
# is date-based (always distinct, no manual "when do we bump this"
150+
# decision needed for a pipeline that releases roughly daily).
151+
export SWIFTBUDDY_MARKETING_VERSION="$(date -u +%Y.%m.%d)"
152+
export SWIFTBUDDY_BUILD_NUMBER="$(git rev-list --count HEAD)"
153+
echo "App version: ${SWIFTBUDDY_MARKETING_VERSION} (${SWIFTBUDDY_BUILD_NUMBER})"
143154
cd SwiftBuddy && python3 generate_xcodeproj.py
144155
cd ..
145156
xcodebuild clean build \
@@ -187,7 +198,7 @@ jobs:
187198
### Download
188199
189200
- **CLI Server**: [macOS Apple Silicon (arm64)](https://github.com/SharpAI/SwiftLM/releases/download/${{ steps.tag.outputs.name }}/SwiftLM-${{ steps.tag.outputs.name }}-macos-arm64.tar.gz)
190-
- **GUI Desktop App**: Download the attached `SwiftBuddy-macOS.dmg` below!
201+
- **GUI Desktop App**: Download the attached DMG file below!
191202
192203
### Quick Start
193204

SwiftBuddy/generate_xcodeproj.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44
Includes MLXInferenceCore sources directly + local SPM packages (mlx-swift, mlx-swift-lm).
55
Run from the SwiftBuddy/ directory:
66
python3 generate_xcodeproj.py
7+
8+
Since this script (not a checked-in Info.plist) regenerates project.pbxproj
9+
fresh on every build, it's also the single place that controls the app's
10+
displayed version — MARKETING_VERSION (CFBundleShortVersionString) and
11+
CURRENT_PROJECT_VERSION (CFBundleVersion) were previously hardcoded to
12+
"1.0"/"1" here, so every release ever built reported the same version
13+
regardless of which commit or CI run produced it. Override either via env
14+
var; both default to the previous hardcoded values for local/manual runs
15+
where CI hasn't set them:
16+
SWIFTBUDDY_MARKETING_VERSION e.g. "2026.08.27" (release.yml sets this
17+
to the build date — see that workflow)
18+
SWIFTBUDDY_BUILD_NUMBER e.g. "703" (release.yml sets this to
19+
`git rev-list --count HEAD`, the same
20+
counter its bNNN release tags use)
721
"""
822

923
import os, uuid
@@ -12,6 +26,9 @@
1226
def uid():
1327
return uuid.uuid4().hex[:24].upper()
1428

29+
MARKETING_VERSION = os.environ.get("SWIFTBUDDY_MARKETING_VERSION", "1.0")
30+
BUILD_NUMBER = os.environ.get("SWIFTBUDDY_BUILD_NUMBER", "1")
31+
1532
# ── UUIDs ─────────────────────────────────────────────────────────────
1633
PROJ = uid()
1734
MAIN_GRP = uid()
@@ -343,7 +360,7 @@ def pbxproj():
343360
\t\t\t\tASSTCATALOG_COMPILER_APPICON_NAME = AppIcon;
344361
\t\t\t\tASSTCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
345362
\t\t\t\tCODE_SIGN_STYLE = Automatic;
346-
\t\t\t\tCURRENT_PROJECT_VERSION = 1;
363+
\t\t\t\tCURRENT_PROJECT_VERSION = {BUILD_NUMBER};
347364
\t\t\t\tGENERATE_INFOPLIST_FILE = YES;
348365
\t\t\t\tINFOPLIST_KEY_CFBundleDisplayName = "SwiftBuddy Chat";
349366
\t\t\t\tINFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2026 SharpAI";
@@ -354,7 +371,7 @@ def pbxproj():
354371
\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
355372
\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 17.0;
356373
\t\t\t\tMACOS_DEPLOYMENT_TARGET = 14.0;
357-
\t\t\t\tMARKETING_VERSION = 1.0;
374+
\t\t\t\tMARKETING_VERSION = {MARKETING_VERSION};
358375
\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.sharpai.SwiftBuddy;
359376
\t\t\t\tPRODUCT_NAME = "$(TARGET_NAME)";
360377
\t\t\t\tSDKROOT = auto;
@@ -371,12 +388,12 @@ def pbxproj():
371388
\t\t\t\tASSTCATALOG_COMPILER_APPICON_NAME = AppIcon;
372389
\t\t\t\tASSTCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
373390
\t\t\t\tCODE_SIGN_STYLE = Automatic;
374-
\t\t\t\tCURRENT_PROJECT_VERSION = 1;
391+
\t\t\t\tCURRENT_PROJECT_VERSION = {BUILD_NUMBER};
375392
\t\t\t\tGENERATE_INFOPLIST_FILE = YES;
376393
\t\t\t\tINFOPLIST_KEY_CFBundleDisplayName = "SwiftBuddy Chat";
377394
\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 17.0;
378395
\t\t\t\tMACOS_DEPLOYMENT_TARGET = 14.0;
379-
\t\t\t\tMARKETING_VERSION = 1.0;
396+
\t\t\t\tMARKETING_VERSION = {MARKETING_VERSION};
380397
\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.sharpai.SwiftBuddy;
381398
\t\t\t\tPRODUCT_NAME = "$(TARGET_NAME)";
382399
\t\t\t\tSDKROOT = auto;

0 commit comments

Comments
 (0)