From f66e48bcf25fad454f5dc424486bc3b2120d686d Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Sun, 14 Jun 2026 16:17:21 -0400 Subject: [PATCH] chore: add versioning workflow --- .github/workflows/version.yml | 77 +++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/version.yml diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml new file mode 100644 index 0000000..b6bcc7f --- /dev/null +++ b/.github/workflows/version.yml @@ -0,0 +1,77 @@ +name: Bump version + +on: + workflow_dispatch: + inputs: + version: + description: "New version string (e.g., 1.1.0)" + required: true + type: string + +permissions: + contents: write + pull-requests: write + +jobs: + bump-version: + name: Bump version + runs-on: macos-26 + timeout-minutes: 15 + + steps: + - name: Checkout current repository + uses: actions/checkout@v4 + 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 + echo "Error: version input is required" + exit 1 + fi + echo "Bumping version to: ${{ inputs.version }}" + + - 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" + + # Verify changes were made + echo "Updated MARKETING_VERSION entries:" + grep "MARKETING_VERSION = " "$PROJECT_FILE" | head -5 + echo "..." + + - name: Commit changes + run: | + 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 + 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" \ + --base main \ + --head "$PR_BRANCH" \ + --draft