|
| 1 | +--- |
| 2 | +title: "Mobile CI/CD" |
| 3 | +description: "EAS builds, preview distribution, and PR OTA updates for the Expo app. Android-only v1." |
| 4 | +--- |
| 5 | + |
| 6 | +Mobile CI/CD uses GitHub Actions and EAS (Expo Application Services) for builds and PR previews. v1 is **Android-only**; no Apple/Google developer accounts required. Store submission is deferred. |
| 7 | + |
| 8 | +## v1 Flow: Install Once, Review Many PRs |
| 9 | + |
| 10 | +1. **Bootstrap (one-time)**: Build Android preview (manual or from main) → share Expo internal distribution link with reviewers. |
| 11 | +2. **Reviewers**: Install the APK on their devices (one time). |
| 12 | +3. **Per PR**: `mobile-pr-preview` publishes an EAS Update and comments a QR code on the PR. |
| 13 | +4. **Reviewers**: Open the installed app, scan the QR → load that PR's update. |
| 14 | + |
| 15 | +**Without steps 1–2, OTA updates have nothing to attach to.** Reviewers cannot use QR-only previews without a baseline build installed first. |
| 16 | + |
| 17 | +## EAS Update: JS-Only |
| 18 | + |
| 19 | +EAS Update delivers **JS/TS changes only**. A new build is required for: |
| 20 | + |
| 21 | +- Native dependencies (new packages with native code) |
| 22 | +- Config plugins, app.json/native config changes |
| 23 | +- Permissions (camera, location, etc. in app.json) |
| 24 | +- Splash, icon, adaptive icon changes |
| 25 | +- Any change that affects the native binary |
| 26 | + |
| 27 | +When such a change lands, run a manual build or merge to main so `mobile-preview` produces a fresh baseline. PR OTA will then work again. |
| 28 | + |
| 29 | +## Workflows |
| 30 | + |
| 31 | +| Workflow | Trigger | Use | |
| 32 | +|----------|---------|-----| |
| 33 | +| `mobile-build` | Manual | One-off Android preview or development build | |
| 34 | +| `mobile-preview` | Push to `main` | Auto-build baseline when mobile or UI changes | |
| 35 | +| `mobile-pr-preview` | Pull request | Publish OTA update, comment QR (app-facing PRs only) | |
| 36 | + |
| 37 | +Path filters for `mobile-preview` and `mobile-pr-preview`: `apps/mobile/**`, `packages/ui/**` — avoids running on unrelated PRs. |
| 38 | + |
| 39 | +## Setup |
| 40 | + |
| 41 | +### 1. EAS and EXPO_TOKEN |
| 42 | + |
| 43 | +1. Run `cd apps/mobile && npx eas-cli@latest init` (requires Expo account login). |
| 44 | +2. Create a [robot user](https://docs.expo.dev/accounts/programmatic-access/#robot-users-and-access-tokens) and access token. |
| 45 | +3. Add `EXPO_TOKEN` to GitHub repo: Settings → Secrets and variables → Actions. |
| 46 | + |
| 47 | +**EXPO_TOKEN is required.** Workflows fail without it for configured repos. |
| 48 | + |
| 49 | +### 2. Bootstrap Build |
| 50 | + |
| 51 | +Run `mobile-build` manually (profile: preview, platform: android). Share the Expo build link with reviewers so they can install the baseline APK. |
| 52 | + |
| 53 | +### 3. First PR Preview |
| 54 | + |
| 55 | +Create a PR that touches `apps/mobile/` or `packages/ui/`. `mobile-pr-preview` will publish an update and comment with a QR code. Reviewers scan the QR in the installed app to load the PR's update. |
| 56 | + |
| 57 | +## eas.json |
| 58 | + |
| 59 | +Build profiles (v1): `preview`, `development`, `e2e-test`. No `submit` block until Apple/Google exist. See [When You Add Apple/Google](#when-you-add-applegoogle) below. |
| 60 | + |
| 61 | +## When You Add Apple/Google |
| 62 | + |
| 63 | +1. **Apple**: Enroll in Apple Developer Program; run `eas credentials` from `apps/mobile`. Add `submit` block to `eas.json`. |
| 64 | +2. **Google**: Create Play Console app, add service account JSON to EAS or GitHub Secrets. Extend `submit` block. |
| 65 | +3. **Workflows**: Add `mobile-release` (tag trigger) and `mobile-submit` (manual). Change `mobile-preview` and `mobile-build` to `--platform all` when iOS credentials exist. |
| 66 | + |
| 67 | +## Related Documentation |
| 68 | + |
| 69 | +- [GitHub Actions](/docs/deployment/github-actions) - All CI workflows |
| 70 | +- [E2E Testing](/docs/testing/e2e-testing) - Maestro flows for mobile |
0 commit comments