Showing the changes to .github (1 of 12 files). Show all
Unified · Split
| @@ -0,0 +1,110 @@ | |||
| 1 | name: Mobile EAS Production | ||
| 2 | |||
| 3 | # Production builds and OTA updates run from CI (Linux) — never from a laptop. | ||
| 4 | # Under the fingerprint runtime-version policy the fingerprint must be computed | ||
| 5 | # in the same OS/pnpm as the EAS build; a macOS `eas build` computes a different | ||
| 6 | # fingerprint (platform-specific deps + pnpm version) and errors. On this Linux | ||
| 7 | # runner, with corepack pinning pnpm 10.24 in eas.json, local == build. | ||
| 8 | on: | ||
| 9 | workflow_dispatch: | ||
| 10 | inputs: | ||
| 11 | mode: | ||
| 12 | description: "build (+ auto-submit to TestFlight) or update (OTA)" | ||
| 13 | required: true | ||
| 14 | type: choice | ||
| 15 | default: build | ||
| 16 | options: | ||
| 17 | - build | ||
| 18 | - update | ||
| 19 | platform: | ||
| 20 | description: "Target platform" | ||
| 21 | required: true | ||
| 22 | type: choice | ||
| 23 | default: ios | ||
| 24 | options: | ||
| 25 | - ios | ||
| 26 | - android | ||
| 27 | - all | ||
| 28 | message: | ||
| 29 | description: "OTA update message (mode=update only)" | ||
| 30 | required: false | ||
| 31 | type: string | ||
| 32 | |||
| 33 | jobs: | ||
| 34 | production: | ||
| 35 | name: EAS Production ${{ inputs.mode }} | ||
| 36 | runs-on: blacksmith-8vcpu-ubuntu-2404 | ||
| 37 | permissions: | ||
| 38 | contents: read | ||
| 39 | env: | ||
| 40 | APP_VARIANT: production | ||
| 41 | NODE_OPTIONS: --max-old-space-size=8192 | ||
| 42 | steps: | ||
| 43 | - id: expo-token | ||
| 44 | name: Check for EXPO_TOKEN | ||
| 45 | env: | ||
| 46 | EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} | ||
| 47 | run: | | ||
| 48 | if [ -n "$EXPO_TOKEN" ]; then | ||
| 49 | echo "present=true" >> "$GITHUB_OUTPUT" | ||
| 50 | else | ||
| 51 | echo "present=false" >> "$GITHUB_OUTPUT" | ||
| 52 | echo "EXPO_TOKEN is not available; skipping EAS production job." | ||
| 53 | fi | ||
| 54 | |||
| 55 | - name: Checkout | ||
| 56 | if: steps.expo-token.outputs.present == 'true' | ||
| 57 | uses: actions/checkout@v6 | ||
| 58 | with: | ||
| 59 | fetch-depth: 0 | ||
| 60 | |||
| 61 | - name: Setup Vite+ | ||
| 62 | if: steps.expo-token.outputs.present == 'true' | ||
| 63 | uses: voidzero-dev/setup-vp@v1 | ||
| 64 | with: | ||
| 65 | node-version-file: package.json | ||
| 66 | cache: true | ||
| 67 | run-install: true | ||
| 68 | |||
| 69 | - name: Expose pnpm | ||
| 70 | if: steps.expo-token.outputs.present == 'true' | ||
| 71 | run: | | ||
| 72 | pnpm_version="$(node --print "require('./package.json').packageManager.split('@').pop()")" | ||
| 73 | vp_pnpm_bin="$HOME/.vite-plus/package_manager/pnpm/$pnpm_version/pnpm/bin" | ||
| 74 | echo "$vp_pnpm_bin" >> "$GITHUB_PATH" | ||
| 75 | "$vp_pnpm_bin/pnpm" --version | ||
| 76 | |||
| 77 | - name: Setup EAS | ||
| 78 | if: steps.expo-token.outputs.present == 'true' | ||
| 79 | uses: expo/expo-github-action@v8 | ||
| 80 | with: | ||
| 81 | eas-version: latest | ||
| 82 | token: ${{ secrets.EXPO_TOKEN }} | ||
| 83 | packager: pnpm | ||
| 84 | |||
| 85 | - name: Pull production environment variables | ||
| 86 | if: steps.expo-token.outputs.present == 'true' | ||
| 87 | working-directory: apps/mobile | ||
| 88 | env: | ||
| 89 | EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} | ||
| 90 | run: eas env:pull production --non-interactive | ||
| 91 | |||
| 92 | - name: Build and submit | ||
| 93 | if: steps.expo-token.outputs.present == 'true' && inputs.mode == 'build' | ||
| 94 | working-directory: apps/mobile | ||
| 95 | env: | ||
| 96 | EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} | ||
| 97 | run: eas build --platform ${{ inputs.platform }} --profile production --auto-submit --non-interactive --no-wait | ||
| 98 | |||
| 99 | - name: Publish OTA update | ||
| 100 | if: steps.expo-token.outputs.present == 'true' && inputs.mode == 'update' | ||
| 101 | working-directory: apps/mobile | ||
| 102 | env: | ||
| 103 | EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} | ||
| 104 | run: | | ||
| 105 | eas update \ | ||
| 106 | --channel production \ | ||
| 107 | --environment production \ | ||
| 108 | --platform ${{ inputs.platform }} \ | ||
| 109 | --message "${{ inputs.message || format('Production OTA ({0})', github.sha) }}" \ | ||
| 110 | --non-interactive | ||