Skip to content

Cloud Build

Cloud Build #3

Workflow file for this run

# You can use this to manually trigger a cloud build on Expo EAS
# Pros:
# * After the build finishes, Expo makes it easy and convenient to download the APK/IPA file onto one's device,
# whereas the Github artifacts are a little less convenient.
# Cons:
# * Expo EAS builds have a limited quota, whereas we don't have a limit when running on Github actions.
# * Waiting in the Expo queue, which if you're on free tier (as we currently are), can sometimes be a very long wait.
# In contrast, the Github runners usually start running immediately.
name: Cloud Build
on:
workflow_dispatch:
inputs:
platform:
type: choice
description: "Which mobile platforms to build"
required: true
default: "android"
options:
- android
- ios
- all
releaseChannel:
type: choice
description: "type of release"
required: true
default: "alpha"
options:
- developer
- alpha
- beta
- release
jobs:
build-mobile:
name: Build application binaries
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/mobile
steps:
- name: Check for EXPO_TOKEN
run: |
if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
exit 1
fi
working-directory: ./
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.14.*
cache: yarn
cache-dependency-path: "**/yarn.lock"
- name: yarn install
# run: yarn --frozen-lockfile # TODO: --frozen-lockfile is erroring out, saying it must be updated. But it doesn't do that on my local machine. Why does it do that on the Github runner? Both seem to be using the same yarn version, 1.22.19
run: yarn
- name: "Check for compile errors"
# Note: Running "tsc" at the end of "yarn build" is the relevant part here.
run: yarn build
- name: "Check if webapp was copied"
id: check-webapp-copied
run: |
if [ -f "assets/web-dist/index.html" ] || [ -e "assets/web-dist/index.html" ]; then
echo "File exists"
echo "file_exists=true" >> $GITHUB_OUTPUT
else
echo "File does not exist"
echo "file_exists=false" >> $GITHUB_OUTPUT
fi
- name: "Fail if webapp didn't get copied"
if: steps.check-webapp-copied.outputs.file_exists != 'true'
run: |
echo "The file does not exist at assets/web-dist/index.html"
exit 1
- name: 3A) [mobile] Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}