Open History to see the last commit
1name: Mobile EAS Preview
2β
3on:
4 pull_request:
5 types: [opened, reopened, synchronize, labeled]
6β
7jobs:
8 preview:
9 name: EAS Preview
10 # Fork PRs deploy one reviewed commit per label through mobile-eas-preview-fork.yml.
11 if: |
12 github.event.pull_request.head.repo.full_name == github.repository &&
13 contains(github.event.pull_request.labels.*.name, 'π Mobile Continuous Deployment') &&
14 (github.event.action != 'labeled' || github.event.label.name == 'π Mobile Continuous Deployment')
15 runs-on: blacksmith-8vcpu-ubuntu-2404
16 concurrency:
17 group: mobile-eas-preview-${{ github.event.pull_request.number }}
18 cancel-in-progress: true
19 permissions:
20 contents: read
21 pull-requests: write
22 env:
23 APP_VARIANT: preview
24 NODE_OPTIONS: --max-old-space-size=8192
25 MOBILE_VERSION_POLICY: fingerprint
26 steps:
27 - id: expo-token
28 name: Check for EXPO_PREVIEW_TOKEN
29 env:
30 EXPO_TOKEN: ${{ secrets.EXPO_PREVIEW_TOKEN }}
31 run: |
32 if [ -n "$EXPO_TOKEN" ]; then
33 echo "present=true" >> "$GITHUB_OUTPUT"
34 else
35 echo "present=false" >> "$GITHUB_OUTPUT"
36 echo "EXPO_PREVIEW_TOKEN is not available; skipping EAS preview."
37 fi
38β
39 - name: Checkout
40 if: steps.expo-token.outputs.present == 'true'
41 uses: actions/checkout@v6
42 with:
43 fetch-depth: 0
44 # No sparse-checkout here: it makes actions/checkout fetch with
45 # --filter=blob:none, and eas-cli archives the project via
46 # `git clone --depth 1 file://<workspace>`, which fails (exit 128)
47 # when the partial clone can't serve the unfetched blobs.
48β
49 - name: Setup Vite+
50 if: steps.expo-token.outputs.present == 'true'
51 uses: voidzero-dev/setup-vp@v1
52 with:
53 node-version-file: package.json
54 cache: true
55 run-install: |
56 args:
57 - --filter=@t3tools/mobile...
58β
59 - name: Expose pnpm
60 if: steps.expo-token.outputs.present == 'true'
61 run: |
62 pnpm_version="$(node --print "require('./package.json').packageManager.split('@').pop()")"
63 vp_pnpm_bin="$HOME/.vite-plus/package_manager/pnpm/$pnpm_version/pnpm/bin"
64 echo "$vp_pnpm_bin" >> "$GITHUB_PATH"
65 "$vp_pnpm_bin/pnpm" --version
66β
67 - name: Setup EAS
68 if: steps.expo-token.outputs.present == 'true'
69 uses: expo/expo-github-action@v8
70 with:
71 # eas-cli 22 renamed `project` to `app` in build JSON, and
72 # continuous-deploy-fingerprint still reads `build.project.ownerAccount`.
73 # Unpin once https://github.com/expo/expo-github-action/issues/358 is fixed.
74 eas-version: 21.8.0
75 token: ${{ secrets.EXPO_PREVIEW_TOKEN }}
76 # npm, not pnpm: this only installs eas-cli into the action's own
77 # tool dir, and pnpm 11 hard-fails that install on dtrace-provider's
78 # ignored build script (no allowBuilds config outside the repo).
79 packager: npm
80β
81 - name: Pull preview environment variables
82 if: steps.expo-token.outputs.present == 'true'
83 working-directory: apps/mobile
84 env:
85 EXPO_TOKEN: ${{ secrets.EXPO_PREVIEW_TOKEN }}
86 run: |
87 eas env:pull preview --non-interactive
88 # EAS Update disables dotenv loading. Keep the downloaded native config
89 # in its process environment so Android build and OTA fingerprints match.
90 node --input-type=module <<'NODE'
91 import { appendFileSync, readFileSync } from "node:fs";
92 import { parseEnv } from "node:util";
93 const env = parseEnv(readFileSync(".env.local", "utf8"));
94 const googleServicesFile = env.T3CODE_ANDROID_GOOGLE_SERVICES_FILE;
95 if (googleServicesFile) {
96 appendFileSync(process.env.GITHUB_ENV, `T3CODE_ANDROID_GOOGLE_SERVICES_FILE=${googleServicesFile}\n`);
97 }
98 NODE
99β
100 - name: Deploy with fingerprint check
101 if: steps.expo-token.outputs.present == 'true'
102 uses: expo/expo-github-action/continuous-deploy-fingerprint@main
103 env:
104 EXPO_TOKEN: ${{ secrets.EXPO_PREVIEW_TOKEN }}
105 # The Expo action otherwise suppresses the EAS command's failure output.
106 RUNNER_DEBUG: "1"
107 with:
108 profile: preview:dev
109 branch: pr-${{ github.event.pull_request.number }}
110 platform: all
111 environment: preview
112 working-directory: apps/mobile
113 github-token: ${{ secrets.GITHUB_TOKEN }}