Skip to content

Commit bf2bb56

Browse files
authored
feat(ci): commit version changes back to main after release (farouqaldori#38)
* feat(ci): commit version changes back to main after release When a release tag is pushed, the workflow now commits the updated project.pbxproj back to main branch, ensuring the repository always reflects the released version. - Add permissions: contents: write for push access - Commit version changes with [skip ci] to prevent loops - Use --no-verify to bypass pre-commit hooks in CI - Only commit if version actually changed * fix(ci): skip code-quality workflow for [skip ci] commits Add job condition to skip the pre-commit checks when commit message contains [skip ci]. This ensures version bump commits from the release workflow don't trigger unnecessary workflow runs.
1 parent 8dd81b2 commit bf2bb56

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

.github/workflows/code-quality.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
prek:
1111
name: Pre-commit Checks
1212
runs-on: macos-latest
13+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
1314

1415
steps:
1516
- name: Checkout repository

.github/workflows/release.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
description: 'Version to release (without v prefix)'
1010
required: true
1111

12+
permissions:
13+
contents: write
14+
1215
jobs:
1316
build:
1417
runs-on: macos-15 # Use macos-15 for Xcode 16.x support (macos-latest becomes macos-15 in Aug 2025)
@@ -37,13 +40,30 @@ jobs:
3740
echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
3841
fi
3942
40-
- name: Update Xcode project version from tag
43+
- name: Update Xcode project version and commit
4144
run: |
4245
# Set marketing version (CFBundleShortVersionString) from tag
4346
agvtool new-marketing-version "${{ steps.version.outputs.version }}"
4447
# Set build number (CFBundleVersion) using timestamp for uniqueness
4548
agvtool new-version -all "$(date +%Y%m%d%H%M)"
4649
50+
# Commit version changes back to repository
51+
if git diff --quiet ClaudeIsland.xcodeproj/project.pbxproj; then
52+
echo "Version already matches tag, no commit needed"
53+
else
54+
# Configure git
55+
git config user.name "github-actions[bot]"
56+
git config user.email "github-actions[bot]@users.noreply.github.com"
57+
58+
# Commit version change (--no-verify bypasses pre-commit hooks)
59+
git add ClaudeIsland.xcodeproj/project.pbxproj
60+
git commit --no-verify -m "chore: bump version to ${{ steps.version.outputs.version }} [skip ci]"
61+
62+
# Push to main branch
63+
git push origin HEAD:main
64+
echo "✅ Version committed and pushed to main"
65+
fi
66+
4767
- name: Build with ad-hoc signing
4868
run: ./scripts/build.sh
4969

0 commit comments

Comments
 (0)