Skip to content

Commit dbc99f6

Browse files
authored
feat(ci): auto-sync app version from git tag during release (farouqaldori#36)
* feat(ci): auto-sync app version from git tag during release Move version extraction step before build in release workflow so agvtool can update the Xcode project version from the git tag. Build numbers use timestamps for uniqueness. Also adds version mismatch warning to local build script and syncs current version to 1.3.1. * fix(ci): restore Info.plist build variables and git describe path - Revert Info.plist to use $(MARKETING_VERSION) and $(CURRENT_PROJECT_VERSION) so agvtool updates during CI release flow properly affect the app bundle - Run git describe from PROJECT_DIR to ensure consistent tag detection regardless of caller's working directory
1 parent df2dd54 commit dbc99f6

3 files changed

Lines changed: 32 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,22 @@ jobs:
2828
with:
2929
xcode-version: latest-stable
3030

31+
- name: Get version from tag
32+
id: version
33+
run: |
34+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
35+
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
36+
else
37+
echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
38+
fi
39+
40+
- name: Update Xcode project version from tag
41+
run: |
42+
# Set marketing version (CFBundleShortVersionString) from tag
43+
agvtool new-marketing-version "${{ steps.version.outputs.version }}"
44+
# Set build number (CFBundleVersion) using timestamp for uniqueness
45+
agvtool new-version -all "$(date +%Y%m%d%H%M)"
46+
3147
- name: Build with ad-hoc signing
3248
run: ./scripts/build.sh
3349

@@ -57,15 +73,6 @@ jobs:
5773
fi
5874
./scripts/create-release.sh --skip-notarization --skip-github --skip-website $SPARKLE_FLAG
5975
60-
- name: Get version
61-
id: version
62-
run: |
63-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
64-
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
65-
else
66-
echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
67-
fi
68-
6976
- name: Rename DMG to match release version
7077
id: rename-dmg
7178
run: |

ClaudeIsland.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@
283283
CODE_SIGN_ENTITLEMENTS = ClaudeIsland/Resources/ClaudeIsland.entitlements;
284284
CODE_SIGN_STYLE = Automatic;
285285
COMBINE_HIDPI_IMAGES = YES;
286-
CURRENT_PROJECT_VERSION = 3;
286+
CURRENT_PROJECT_VERSION = 202601192331;
287287
DEVELOPMENT_TEAM = "";
288288
ENABLE_APP_SANDBOX = NO;
289289
ENABLE_HARDENED_RUNTIME = YES;
@@ -318,7 +318,7 @@
318318
CODE_SIGN_ENTITLEMENTS = ClaudeIsland/Resources/ClaudeIsland.entitlements;
319319
CODE_SIGN_STYLE = Automatic;
320320
COMBINE_HIDPI_IMAGES = YES;
321-
CURRENT_PROJECT_VERSION = 3;
321+
CURRENT_PROJECT_VERSION = 202601192331;
322322
DEVELOPMENT_TEAM = "";
323323
ENABLE_APP_SANDBOX = NO;
324324
ENABLE_HARDENED_RUNTIME = YES;

scripts/build.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
77
BUILD_DIR="$PROJECT_DIR/build"
88
EXPORT_PATH="$BUILD_DIR/export"
99

10+
# Check if local version matches latest git tag
11+
check_version_sync() {
12+
LATEST_TAG=$(cd "$PROJECT_DIR" && git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//')
13+
if [ -n "$LATEST_TAG" ]; then
14+
CURRENT_VERSION=$(cd "$PROJECT_DIR" && agvtool what-marketing-version -terse1 2>/dev/null)
15+
if [ -n "$CURRENT_VERSION" ] && [ "$LATEST_TAG" != "$CURRENT_VERSION" ]; then
16+
echo "⚠️ Warning: Local version ($CURRENT_VERSION) differs from latest tag ($LATEST_TAG)"
17+
echo " Run: agvtool new-marketing-version $LATEST_TAG"
18+
echo ""
19+
fi
20+
fi
21+
}
22+
check_version_sync
23+
1024
echo "=== Building Claude Island (Ad-Hoc Signed) ==="
1125
echo ""
1226

0 commit comments

Comments
 (0)