Triggering builds from CI
This document outlines how to trigger builds on EAS for your app from a CI environment such as GitHub Actions.
Before building with EAS on CI, we need to install and configure eas-cli
. Then, we can trigger new builds with the eas build
command.
To trigger EAS builds from a CI environment, we first need to configure our app for EAS Build and successfully run a build from our local machine for each platform that we'd like to support on CI.
If you have run eas build -p [all|ios|android]
successfully before, then you can continue.
Are you using the classic build system? (expo build:[android|ios]
)
Next, we need to ensure that we can authenticate ourselves on CI as the owner of the app. This is possible by storing a personal access token in the EXPO_TOKEN
environment variable in the CI settings.
In the event your iOS credentials need to be repaired, we will need an ASC API key to authenticate ourselves to Apple in CI. A common case is when your provisioning profile needs to be re-signed.
You will need to create an
API Key. Next, you will need to gather information about your
Apple Team.
Using the information you've gathered, pass it into the build command through environment variables. You will need to pass in the following:
EXPO_ASC_API_KEY_PATH
: the path to your ASC API Key .p8 file, e.g. /path/to/key/AuthKey_SFB993FB5F.p8EXPO_ASC_KEY_ID
: the key ID of your ASC API Key, e.g. SFB993FB5F.EXPO_ASC_ISSUER_ID
: the issuer ID of your ASC API Key, e.g. f9675cff-f45d-4116-bd2c-2372142cee09.EXPO_APPLE_TEAM_ID
: your Apple Team ID, e.g. 77KQ969CHE.EXPO_APPLE_TEAM_TYPE
: your Apple Team Type. Valid types are IN_HOUSE
, COMPANY_OR_ORGANIZATION
, or INDIVIDUAL
.
Now that we're authenticated with Expo CLI, we can create the build step.
To trigger new builds, we will add this script to our configuration:
npx eas-cli build --platform all --non-interactive
This will trigger a new build on EAS and print the URLs for the built files after the build completes.
Travis CI
---
language: node_js
node_js:
- node
- lts/*
cache:
directories:
- ~/.npm
before_script:
- npm install -g npm@latest
jobs:
include:
- stage: build
node_js: lts/*
script:
- npm ci
- npx eas-cli build --platform all --non-interactive
Put this into .travis.yml
in the root of your repository.
GitLab CI
image: node:alpine
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- ~/.npm
stages:
- build
before_script:
- npm ci
eas-build:
stage: build
script:
- apk add --no-cache bash
- npx eas-cli build --platform all --non-interactive
Put this into .gitlab-ci.yml
in the root of your repository.
Bitbucket Pipelines
image: node:alpine
definitions:
caches:
npm: ~/.npm
pipelines:
default:
- step:
name: Build app
deployment: test
caches:
- npm
script:
- apk add --no-cache bash
- npm ci
- npx eas-cli build --platform all --non-interactive
Put this into bitbucket-pipelines.yml
in the root of your repository.
CircleCI
version: 2.1
executors:
default:
docker:
- image: cimg/node:lts
working_directory: ~/my-app
jobs:
eas_build:
executor: default
steps:
- checkout
- run:
name: Install dependencies
command: npm ci
- run:
name: Trigger build
command: npx eas-cli build --platform all --non-interactive
workflows:
build_app:
jobs:
- eas_build:
filters:
branches:
only: master
Put this into .circleci/config.yml
in the root of your repository.
GitHub Actions
name: EAS Build
on:
workflow_dispatch:
push:
branches:
- master
jobs:
build:
name: Install and build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
cache: npm
- name: Setup Expo and EAS
uses: expo/expo-github-action@v7
with:
expo-version: 5.x
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Install dependencies
run: npm ci
- name: Build on EAS
run: eas build --platform all --non-interactive
Put this into .github/workflows/eas-build.yml
in the root of your repository.