bump ota version #714
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################################################################################## | |
| # | |
| # This Workflow is responsible for triggering release candidate builds (iOS & Android). | |
| # It runs on every commit pushed to a release branch, but only when the release PR | |
| # has the 'auto-rc-builds' label. | |
| # | |
| # Rolling builds: when a new run starts for the same release branch, any queued or | |
| # in-progress run of this workflow for that branch is cancelled (same behavior as | |
| # Bitrise “Rolling builds” / “Abort running builds” for one branch + one workflow). | |
| # | |
| # Version bump runs once (update-latest-build-version.yml), then iOS and Android | |
| # builds are triggered in parallel via runway-ota-build-core.yml (skip_version_bump). | |
| # | |
| ############################################################################################## | |
| name: Auto RC builds | |
| on: | |
| push: | |
| branches: | |
| - 'release/*' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| actions: write | |
| id-token: write | |
| jobs: | |
| validate-and-check-label: | |
| name: Validate branch and check PR label | |
| runs-on: ubuntu-latest | |
| outputs: | |
| semver: ${{ steps.extract-version.outputs.semver }} | |
| has-label: ${{ steps.check-label.outputs.has-label }} | |
| branch-name: ${{ steps.extract-version.outputs.branch-name }} | |
| pr-number: ${{ steps.check-label.outputs.pr-number }} | |
| permissions: | |
| pull-requests: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 1 | |
| - name: Extract semver from branch name | |
| id: extract-version | |
| run: | | |
| BRANCH_NAME="${{ github.ref_name }}" | |
| echo "Checking branch: $BRANCH_NAME" | |
| echo "branch-name=$BRANCH_NAME" >> "$GITHUB_OUTPUT" | |
| # Validate branch matches release/x.y.z format (semantic versioning) | |
| if [[ "$BRANCH_NAME" =~ ^release/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| VERSION="${BRANCH_NAME#release/}" | |
| echo "Valid release branch detected: $BRANCH_NAME (version: $VERSION)" | |
| echo "semver=$VERSION" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Branch '$BRANCH_NAME' does not match release/x.y.z pattern. Skipping." | |
| echo "semver=" >> "$GITHUB_OUTPUT" | |
| exit 1 | |
| fi | |
| - name: Find PR and check for auto-rc-builds label | |
| id: check-label | |
| run: | | |
| BRANCH_NAME="${{ github.ref_name }}" | |
| echo "Looking for PR with head branch: $BRANCH_NAME" | |
| # Find PRs where the head branch matches our release branch | |
| PR_NUMBER=$(gh pr list --head "$BRANCH_NAME" --json number --jq '.[0].number' || echo "") | |
| if [[ -z "$PR_NUMBER" ]]; then | |
| echo "No PR found for branch $BRANCH_NAME. Skipping." | |
| echo "has-label=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| echo "Found PR #$PR_NUMBER" | |
| echo "pr-number=$PR_NUMBER" >> "$GITHUB_OUTPUT" | |
| # Check if PR has the auto-rc-builds label | |
| LABELS=$(gh pr view "$PR_NUMBER" --json labels --jq '.labels[].name' || echo "") | |
| if echo "$LABELS" | grep -qx "auto-rc-builds"; then | |
| echo "PR #$PR_NUMBER has 'auto-rc-builds' label. Proceeding with build." | |
| echo "has-label=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "PR #$PR_NUMBER does not have 'auto-rc-builds' label. Skipping build." | |
| echo "has-label=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| update_rc_build_version: | |
| name: Update RC build version | |
| uses: ./.github/workflows/update-latest-build-version.yml | |
| needs: validate-and-check-label | |
| if: needs.validate-and-check-label.outputs.has-label == 'true' | |
| permissions: | |
| contents: write | |
| id-token: write | |
| with: | |
| base-branch: ${{ needs.validate-and-check-label.outputs.branch-name }} | |
| secrets: | |
| PR_TOKEN: ${{ secrets.PR_TOKEN }} | |
| trigger-ios-rc-build: | |
| name: Trigger iOS RC Build | |
| uses: ./.github/workflows/runway-ota-build-core.yml | |
| needs: | |
| - validate-and-check-label | |
| - update_rc_build_version | |
| if: needs.validate-and-check-label.outputs.has-label == 'true' | |
| with: | |
| platform: ios | |
| source_branch: ${{ needs.update_rc_build_version.outputs.commit-hash }} | |
| skip_version_bump: true | |
| secrets: inherit | |
| trigger-android-rc-build: | |
| name: Trigger Android RC Build | |
| uses: ./.github/workflows/runway-ota-build-core.yml | |
| needs: | |
| - validate-and-check-label | |
| - update_rc_build_version | |
| if: needs.validate-and-check-label.outputs.has-label == 'true' | |
| with: | |
| platform: android | |
| source_branch: ${{ needs.update_rc_build_version.outputs.commit-hash }} | |
| skip_version_bump: true | |
| secrets: inherit | |
| post-rc-build-comment: | |
| name: Post RC Build Comment | |
| runs-on: ubuntu-latest | |
| needs: | |
| - validate-and-check-label | |
| - trigger-ios-rc-build | |
| - trigger-android-rc-build | |
| if: always() && needs.trigger-ios-rc-build.result == 'success' && needs.trigger-android-rc-build.result == 'success' && needs.validate-and-check-label.outputs.pr-number != '' | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.validate-and-check-label.outputs.branch-name }} | |
| fetch-depth: 1 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --immutable | |
| - name: Post RC Build Comment | |
| run: node scripts/post-rc-build-comment.mjs | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| PR_NUMBER: ${{ needs.validate-and-check-label.outputs.pr-number }} | |
| SEMVER: ${{ needs.validate-and-check-label.outputs.semver }} | |
| IOS_BUILD_NUMBER: ${{ needs.trigger-ios-rc-build.outputs.ios_version_code }} | |
| ANDROID_BUILD_NUMBER: ${{ needs.trigger-android-rc-build.outputs.android_version_code }} | |
| BUILD_PIPELINE_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| slack-notification: | |
| name: Slack RC Notification | |
| needs: | |
| - validate-and-check-label | |
| - trigger-ios-rc-build | |
| - trigger-android-rc-build | |
| if: always() && needs.trigger-ios-rc-build.result == 'success' && needs.trigger-android-rc-build.result == 'success' | |
| uses: ./.github/workflows/slack-rc-notification.yml | |
| with: | |
| source_branch: ${{ needs.validate-and-check-label.outputs.branch-name }} | |
| semver: ${{ needs.trigger-ios-rc-build.outputs.semantic_version }} | |
| ios_build_number: ${{ needs.trigger-ios-rc-build.outputs.ios_version_code }} | |
| android_build_number: ${{ needs.trigger-android-rc-build.outputs.android_version_code }} | |
| secrets: inherit |