|
| 1 | +name: app store connect |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + asc_issuer_id: |
| 7 | + description: > |
| 8 | + App Store Connect issuer identifier. Required for JWT authentication. |
| 9 | + required: true |
| 10 | + type: string |
| 11 | + asc_key_id: |
| 12 | + description: > |
| 13 | + App Store Connect API key identifier. Required for JWT authentication. |
| 14 | + required: true |
| 15 | + type: string |
| 16 | + release_tag: |
| 17 | + required: true |
| 18 | + type: string |
| 19 | + secrets: |
| 20 | + ASC_AUTH_KEY_B64: |
| 21 | + description: > |
| 22 | + Base64-encoded AuthKey file (.p8) used for App Store Connect API JWT authentication. |
| 23 | + required: true |
| 24 | + |
| 25 | +jobs: |
| 26 | + upload_build: |
| 27 | + runs-on: macos-latest |
| 28 | + environment: release |
| 29 | + permissions: |
| 30 | + contents: read |
| 31 | + steps: |
| 32 | + - name: Add Toolbox Envy to PATH |
| 33 | + uses: EarthmanMuons/toolbox-envy/.github/actions/add-to-path@main |
| 34 | + with: |
| 35 | + include_bins: | |
| 36 | + common |
| 37 | + flutter |
| 38 | +
|
| 39 | + - id: asc_auth |
| 40 | + name: Configure App Store Connect authentication |
| 41 | + env: |
| 42 | + ASC_AUTH_KEY_B64: ${{ secrets.ASC_AUTH_KEY_B64 }} |
| 43 | + ASC_KEY_ID: ${{ inputs.asc_key_id }} |
| 44 | + run: asc-auth-key-setup |
| 45 | + |
| 46 | + - name: Download release assets |
| 47 | + env: |
| 48 | + GH_TOKEN: ${{ github.token }} |
| 49 | + RELEASE_TAG: ${{ inputs.release_tag }} |
| 50 | + run: | |
| 51 | + set -euo pipefail |
| 52 | +
|
| 53 | + mkdir -p dist |
| 54 | + gh release download "$RELEASE_TAG" \ |
| 55 | + --pattern "*.ipa" \ |
| 56 | + --pattern "sha256sums.txt" \ |
| 57 | + --dir dist |
| 58 | +
|
| 59 | + - id: verify_assets |
| 60 | + name: Verify release assets |
| 61 | + run: verify-checksums --dir dist --pattern '*.ipa' |
| 62 | + |
| 63 | + - name: Upload ipa |
| 64 | + env: |
| 65 | + API_PRIVATE_KEYS_DIR: ${{ steps.asc_auth.outputs.asc_key_dir }} |
| 66 | + ASC_ISSUER_ID: ${{ inputs.asc_issuer_id }} |
| 67 | + ASC_KEY_ID: ${{ inputs.asc_key_id }} |
| 68 | + run: | |
| 69 | + set -euo pipefail |
| 70 | + xcrun altool --upload-app --type ios \ |
| 71 | + -f "${{ steps.verify_assets.outputs.asset_path }}" \ |
| 72 | + --apiKey "$ASC_KEY_ID" \ |
| 73 | + --apiIssuer "$ASC_ISSUER_ID" |
| 74 | +
|
| 75 | + - name: Annotate workflow run with uploaded ipa |
| 76 | + run: | |
| 77 | + { |
| 78 | + printf '### :shipit: Uploaded iOS build:\n' |
| 79 | + printf '\n' |
| 80 | + printf -- '- [%s]\n' "${{ steps.verify_assets.outputs.asset_name }}" |
| 81 | + } >>"$GITHUB_STEP_SUMMARY" |
0 commit comments