|
| 1 | +############################################################################################## |
| 2 | +# |
| 3 | +# Auto RC OTA / build core (reusable) |
| 4 | +# |
| 5 | +# Shared logic for the Auto RC flow (build-rc-auto.yml): detect an OTA_VERSION bump and either |
| 6 | +# dispatch push-eas-update.yml, or fall through to build.yml. |
| 7 | +# |
| 8 | +# Runway's manual entry workflows no longer use this file — they call the dedicated OTA-only or |
| 9 | +# build-only workflows (runway-ota-*.yml, runway-*-builds.yml) directly. Kept here to preserve |
| 10 | +# automatic OTA-vs-build detection on every push to a release branch. |
| 11 | +# |
| 12 | +############################################################################################## |
| 13 | +name: Auto RC OTA Build Core |
| 14 | + |
| 15 | +on: |
| 16 | + workflow_call: |
| 17 | + inputs: |
| 18 | + platform: |
| 19 | + description: 'Target platform passed to push-eas-update and build.yml (android or ios)' |
| 20 | + required: true |
| 21 | + type: string |
| 22 | + source_branch: |
| 23 | + description: >- |
| 24 | + Optional branch, tag, or SHA (Build workflow source_branch). |
| 25 | + Empty uses the branch selected in the caller workflow_dispatch "Use workflow from" UI. |
| 26 | + required: false |
| 27 | + type: string |
| 28 | + default: '' |
| 29 | + ota_channel: |
| 30 | + description: 'push-eas-update channel input (e.g. rc, production)' |
| 31 | + required: false |
| 32 | + type: string |
| 33 | + default: rc |
| 34 | + build_name: |
| 35 | + description: 'build.yml build_name (e.g. main-rc, main-prod)' |
| 36 | + required: false |
| 37 | + type: string |
| 38 | + default: main-rc |
| 39 | + create_production_ota_tag: |
| 40 | + description: 'If true, create OTA release tag after production trigger-ota (callers: *production* only)' |
| 41 | + required: false |
| 42 | + type: boolean |
| 43 | + default: false |
| 44 | + environment: |
| 45 | + description: 'Build environment / track passed to upload-to-testflight (e.g. rc, prod)' |
| 46 | + required: false |
| 47 | + type: string |
| 48 | + default: 'rc' |
| 49 | + skip_version_bump: |
| 50 | + description: >- |
| 51 | + If true, build.yml skips update-latest-build-version. Auto-RC callers set true since the |
| 52 | + bump is performed once upstream. |
| 53 | + required: false |
| 54 | + type: boolean |
| 55 | + default: false |
| 56 | + outputs: |
| 57 | + semantic_version: |
| 58 | + description: 'package.json version at the built commit (empty when OTA path taken)' |
| 59 | + value: ${{ jobs.trigger-build.outputs.semantic_version }} |
| 60 | + ios_version_code: |
| 61 | + description: 'iOS CURRENT_PROJECT_VERSION at the built commit (empty when OTA path taken)' |
| 62 | + value: ${{ jobs.trigger-build.outputs.ios_version_code }} |
| 63 | + android_version_code: |
| 64 | + description: 'Android versionCode at the built commit (empty when OTA path taken)' |
| 65 | + value: ${{ jobs.trigger-build.outputs.android_version_code }} |
| 66 | + |
| 67 | +permissions: |
| 68 | + contents: write # required by build.yml (update-build-version job) |
| 69 | + pull-requests: read |
| 70 | + actions: write |
| 71 | + id-token: write # required by build.yml |
| 72 | + |
| 73 | +jobs: |
| 74 | + resolve-context: |
| 75 | + name: Resolve OTA context |
| 76 | + uses: ./.github/workflows/runway-ota-resolve-context.yml |
| 77 | + with: |
| 78 | + source_branch: ${{ inputs.source_branch }} |
| 79 | + secrets: inherit |
| 80 | + |
| 81 | + validate-ota-pr: |
| 82 | + name: Validate PR for OTA |
| 83 | + needs: resolve-context |
| 84 | + if: needs.resolve-context.outputs.ota_bump == 'true' |
| 85 | + runs-on: ubuntu-latest |
| 86 | + steps: |
| 87 | + - name: Validate PR number |
| 88 | + run: | |
| 89 | + if [[ -z "${{ needs.resolve-context.outputs.pr_number }}" ]]; then |
| 90 | + echo "::error::No PR found for this branch. OTA update requires a PR number." |
| 91 | + echo "::error::If you ran the workflow manually (workflow_dispatch), select your release branch in the 'Use workflow from' dropdown (e.g. release/7.71.0), not main." |
| 92 | + exit 1 |
| 93 | + fi |
| 94 | + echo "Using PR #${{ needs.resolve-context.outputs.pr_number }}" |
| 95 | +
|
| 96 | + trigger-ota: |
| 97 | + name: Trigger OTA update |
| 98 | + needs: [resolve-context, validate-ota-pr] |
| 99 | + if: needs.resolve-context.outputs.ota_bump == 'true' |
| 100 | + uses: ./.github/workflows/push-eas-update.yml |
| 101 | + with: |
| 102 | + pr_number: ${{ needs.resolve-context.outputs.pr_number }} |
| 103 | + base_branch: ${{ needs.resolve-context.outputs.base_ref }} |
| 104 | + message: ${{ needs.resolve-context.outputs.ota_version }} |
| 105 | + channel: ${{ inputs.ota_channel }} |
| 106 | + platform: ${{ inputs.platform }} |
| 107 | + secrets: inherit |
| 108 | + |
| 109 | + trigger-build: |
| 110 | + name: Trigger build mobile app |
| 111 | + needs: resolve-context |
| 112 | + if: needs.resolve-context.outputs.ota_bump != 'true' |
| 113 | + uses: ./.github/workflows/build.yml |
| 114 | + with: |
| 115 | + build_name: ${{ inputs.build_name }} |
| 116 | + platform: ${{ inputs.platform }} |
| 117 | + skip_version_bump: ${{ inputs.skip_version_bump }} |
| 118 | + source_branch: ${{ inputs.source_branch || github.ref_name }} |
| 119 | + upload_to_sentry: true |
| 120 | + secrets: inherit |
| 121 | + |
| 122 | + create-ota-production-tag: |
| 123 | + name: Create OTA production release tag |
| 124 | + needs: [resolve-context, trigger-ota] |
| 125 | + if: ${{ inputs.create_production_ota_tag == true }} |
| 126 | + uses: ./.github/workflows/runway-create-ota-production-tag.yml |
| 127 | + with: |
| 128 | + tag_name: ${{ needs.resolve-context.outputs.ota_version }} |
| 129 | + checkout_ref: ${{ inputs.source_branch || github.ref_name }} |
| 130 | + secrets: inherit |
| 131 | + |
| 132 | + upload-ios-testflight: |
| 133 | + name: Upload iOS to TestFlight |
| 134 | + needs: [trigger-build] |
| 135 | + if: ${{ inputs.platform == 'ios' }} |
| 136 | + uses: ./.github/workflows/upload-to-testflight.yml |
| 137 | + with: |
| 138 | + environment: ${{ inputs.environment }} |
| 139 | + source_branch: ${{ inputs.source_branch || github.ref_name }} |
| 140 | + build_branch: ${{ inputs.source_branch || github.ref_name }} |
| 141 | + build_name: ${{ inputs.build_name }} |
| 142 | + build_commit_sha: ${{ needs.trigger-build.outputs.built_commit_sha }} |
| 143 | + build_version: ${{ needs.trigger-build.outputs.semantic_version }} |
| 144 | + build_number: ${{ needs.trigger-build.outputs.ios_version_code }} |
| 145 | + secrets: inherit |
0 commit comments