From fca591fc805594427eb5ebd203c08467591bdb2d Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Sun, 14 Jun 2026 20:43:35 -0400 Subject: [PATCH] chore: fix version bump workflow The Bump version workflow failed at the push step with "fatal: no branch named 'chore/versioning-workflow'": it tried to rename a non-existent branch (a leftover from when the workflow was authored on that branch), and committed directly onto main as a side effect. - Create the branch with `git checkout -B chore/bump-version-` instead of renaming, so it works regardless of the dispatched ref - Set github-actions[bot] git identity explicitly - Pass GH_TOKEN to `gh pr create` so the PR step can authenticate - Move the job off macos-26/Xcode to ubuntu-latest (pure sed edit, no build needed); switch BSD `sed -i ''` to GNU `sed -i` - Drop the unused .bak copy Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/version.yml | 37 +++++++++++++---------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index b6bcc7f..8c52690 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -15,8 +15,8 @@ permissions: jobs: bump-version: name: Bump version - runs-on: macos-26 - timeout-minutes: 15 + runs-on: ubuntu-latest + timeout-minutes: 10 steps: - name: Checkout current repository @@ -24,10 +24,6 @@ jobs: with: ref: ${{ github.ref }} - - name: Set Xcode version - run: | - sudo xcode-select -s /Applications/Xcode_26.5.app - - name: Validate version input run: | if [ -z "${{ inputs.version }}" ]; then @@ -39,39 +35,34 @@ jobs: - name: Update MARKETING_VERSION in project.pbxproj run: | PROJECT_FILE="OpenAppLock.xcodeproj/project.pbxproj" - - # Backup original - cp "$PROJECT_FILE" "$PROJECT_FILE.bak" - + # Replace all MARKETING_VERSION entries # Pattern: MARKETING_VERSION = 1.0; -> MARKETING_VERSION = {new_version}; - sed -i '' 's/\(MARKETING_VERSION = \)[0-9.]*;/\1${{ inputs.version }};/' "$PROJECT_FILE" - + sed -i 's/\(MARKETING_VERSION = \)[0-9.]*;/\1${{ inputs.version }};/' "$PROJECT_FILE" + # Verify changes were made echo "Updated MARKETING_VERSION entries:" grep "MARKETING_VERSION = " "$PROJECT_FILE" | head -5 echo "..." - - name: Commit changes + - name: Create branch, commit, and push run: | + BRANCH_NAME="chore/bump-version-${{ inputs.version }}" + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git checkout -B "$BRANCH_NAME" git add OpenAppLock.xcodeproj/project.pbxproj git commit -m "chore: bump version to ${{ inputs.version }}" - - - name: Push branch - run: | - BRANCH_NAME="chore/bump-version-${{ inputs.version }}" - git branch -m "chore/versioning-workflow" "$BRANCH_NAME" git push origin "$BRANCH_NAME" --force - name: Create pull request + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | PR_BRANCH="chore/bump-version-${{ inputs.version }}" - PR_TITLE="chore: bump version to ${{ inputs.version }}" - PR_BODY="Bumps the app version to ${{ inputs.version }}." - gh pr create \ - --title "$PR_TITLE" \ - --body "$PR_BODY" \ + --title "chore: bump version to ${{ inputs.version }}" \ + --body "Bumps the app version to ${{ inputs.version }}." \ --base main \ --head "$PR_BRANCH" \ --draft