| 1 | + | # Builds the phone app for Android on EAS, to install from a link or a QR |
| 2 | + | # code before it is in Google Play. Nothing is published: the run's summary |
| 3 | + | # links the build's page on expo.dev, which shows the QR code, and the APK. |
| 4 | + | # |
| 5 | + | # - `preview` (default): g1t (beta), sh.g1t.app.preview, a standalone signed |
| 6 | + | # APK that needs no computer: what testers install, from the build page's |
| 7 | + | # QR code. Code changes reach it over the air (`eas update --channel |
| 8 | + | # preview`), so it is built again only when the native side changes; on |
| 9 | + | # main that happens by itself (the paths below). mobile-release.yml |
| 10 | + | # publishes these on g1t.sh/download. |
| 11 | + | # - `development`: g1t (dev), sh.g1t.app.dev, with expo-dev-client. It loads |
| 12 | + | # the app's code from `npx expo start` on your computer. |
| 13 | + | # |
| 14 | + | # Needs the repository secret EXPO_TOKEN (an Expo access token with access |
| 15 | + | # to @flagon-io/g1t). |
| 16 | + | name: Mobile build |
| 17 | + | |
| 18 | + | on: |
| 19 | + | push: |
| 20 | + | branches: [main] |
| 21 | + | paths: |
| 22 | + | - apps/mobile/app.config.ts |
| 23 | + | - apps/mobile/eas.json |
| 24 | + | - apps/mobile/package.json |
| 25 | + | - apps/mobile/assets/images/** |
| 26 | + | workflow_dispatch: |
| 27 | + | inputs: |
| 28 | + | profile: |
| 29 | + | description: "The EAS build profile" |
| 30 | + | type: choice |
| 31 | + | options: [preview, development] |
| 32 | + | default: preview |
| 33 | + | |
| 34 | + | permissions: |
| 35 | + | contents: read |
| 36 | + | |
| 37 | + | concurrency: |
| 38 | + | group: mobile-build-${{ inputs.profile || 'preview' }} |
| 39 | + | cancel-in-progress: true |
| 40 | + | |
| 41 | + | jobs: |
| 42 | + | build: |
| 43 | + | name: Build Android (${{ inputs.profile || 'preview' }}) on EAS |
| 44 | + | runs-on: ubuntu-latest |
| 45 | + | timeout-minutes: 60 |
| 46 | + | env: |
| 47 | + | PROFILE: ${{ inputs.profile || 'preview' }} |
| 48 | + | steps: |
| 49 | + | - uses: actions/checkout@v5 |
| 50 | + | - name: Build on EAS |
| 51 | + | working-directory: apps/mobile |
| 52 | + | env: |
| 53 | + | EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} |
| 54 | + | run: | |
| 55 | + | npx --yes eas-cli@24.12.1 build --platform android --profile "$PROFILE" \ |
| 56 | + | --non-interactive --wait --json > build.json |
| 57 | + | node -e ' |
| 58 | + | const [build] = JSON.parse(require("fs").readFileSync("build.json", "utf8")); |
| 59 | + | const page = `https://expo.dev/accounts/flagon-io/projects/g1t/builds/${build.id}`; |
| 60 | + | const lines = [ |
| 61 | + | `### g1t for Android, ${process.env.PROFILE} build`, |
| 62 | + | "", |
| 63 | + | `- Status: ${build.status}`, |
| 64 | + | `- Version: ${build.appVersion} (versionCode ${build.appBuildVersion})`, |
| 65 | + | `- Install: open [the build on expo.dev](${page}) and scan its QR code with the phone`, |
| 66 | + | build.artifacts?.buildUrl ? `- APK: ${build.artifacts.buildUrl}` : "", |
| 67 | + | ]; |
| 68 | + | console.log(lines.join("\n")); |
| 69 | + | require("fs").appendFileSync(process.env.GITHUB_STEP_SUMMARY, lines.join("\n") + "\n"); |
| 70 | + | if (build.status !== "FINISHED") process.exit(1); |
| 71 | + | ' |