Build and upload to TestFlight #156
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
| name: Build and upload to TestFlight | |
| # Creates a temp branch, bumps version (build.yml), uploads IPA via upload-to-testflight.yml. | |
| # Summary metadata is passed from build.yml outputs (no second checkout for version parsing). | |
| # | |
| on: | |
| workflow_call: | |
| inputs: | |
| source_branch: | |
| description: 'Branch, tag, or SHA to build' | |
| required: true | |
| type: string | |
| environment: | |
| description: 'Build environment / track (exp, beta, rc)' | |
| required: true | |
| type: string | |
| testflight_group: | |
| description: 'TestFlight external testing group' | |
| required: false | |
| type: string | |
| default: 'MetaMask BETA & Release Candidates' | |
| distribute_external: | |
| description: 'Whether to distribute to external testers. Defaults to false; nightly-build.yml relies on the script default (true) so it always distributes externally.' | |
| required: false | |
| type: boolean | |
| default: false | |
| runner_provider: | |
| description: Runner provider forwarded from the caller | |
| required: false | |
| type: string | |
| default: current | |
| workflow_dispatch: | |
| inputs: | |
| source_branch: | |
| description: 'Branch, tag, or SHA to build' | |
| required: true | |
| type: string | |
| default: 'main' | |
| environment: | |
| description: 'Build environment / track' | |
| required: true | |
| type: choice | |
| options: | |
| - exp | |
| - beta | |
| - rc | |
| default: rc | |
| testflight_group: | |
| description: 'TestFlight external testing group' | |
| required: true | |
| type: choice | |
| default: 'MetaMask BETA & Release Candidates' | |
| options: | |
| - 'MetaMask BETA & Release Candidates' | |
| - 'MM Card Team' | |
| - 'Ramp Provider Testing' | |
| distribute_external: | |
| description: 'Whether to distribute to external testers' | |
| required: false | |
| type: boolean | |
| default: false | |
| runner_provider: | |
| description: Runner provider for this manual trial run | |
| required: false | |
| type: choice | |
| options: | |
| - current | |
| - namespace | |
| default: current | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| prepare-build-branch: | |
| uses: ./.github/workflows/create-build-branch.yml | |
| with: | |
| source_branch: ${{ inputs.source_branch }} | |
| secrets: inherit | |
| build: | |
| name: Build iOS (${{ inputs.environment }}) | |
| needs: [prepare-build-branch] | |
| uses: ./.github/workflows/build.yml | |
| with: | |
| build_name: main-${{ inputs.environment }} | |
| platform: ios | |
| skip_version_bump: false | |
| source_branch: ${{ needs.prepare-build-branch.outputs.build_branch }} | |
| runner_provider: ${{ inputs.runner_provider }} | |
| secrets: inherit | |
| upload-ios-testflight: | |
| needs: [prepare-build-branch, build] | |
| uses: ./.github/workflows/upload-to-testflight.yml | |
| with: | |
| environment: ${{ inputs.environment }} | |
| testflight_group: ${{ inputs.testflight_group || 'MetaMask BETA & Release Candidates' }} | |
| source_branch: ${{ inputs.source_branch }} | |
| build_branch: ${{ needs.prepare-build-branch.outputs.build_branch }} | |
| build_name: main-${{ inputs.environment }} | |
| build_commit_sha: ${{ needs.build.outputs.built_commit_sha }} | |
| build_version: ${{ needs.build.outputs.semantic_version }} | |
| build_number: ${{ needs.build.outputs.ios_version_code }} | |
| distribute_external: ${{ inputs.distribute_external }} | |
| runner_provider: ${{ inputs.runner_provider }} | |
| secrets: inherit | |
| cleanup-build-branch: | |
| name: Cleanup build branch | |
| needs: [prepare-build-branch, upload-ios-testflight] | |
| if: always() | |
| runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-ci-linux' || 'ubuntu-latest' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PR_TOKEN || github.token }} | |
| - name: Delete temporary build branch | |
| env: | |
| BRANCH: ${{ needs.prepare-build-branch.outputs.build_branch }} | |
| run: | | |
| if [ -n "$BRANCH" ]; then | |
| git push origin --delete "$BRANCH" || true | |
| echo "🧹 Deleted build branch: $BRANCH" | |
| fi |