GitHub Action
Expo GitHub Action
Publish, build or manage your Expo app with GitHub Actions!
Usage Β Β βΒ Β Examples Β Β βΒ Β Caveats Β Β βΒ Β Changelog
With this Expo action, you have full access to Expo CLI and EAS CLI.
It lets you automate the expo publish
or eas build
commands, leaving you with more time to work on your project.
Some additional features are included to make the usage of this action as simple as possible, like caching and authentication.
This action is customizable through variables defined in the action.yml
.
Here is a summary of all the input options you can use.
variable | default | description |
---|---|---|
expo-version | - | Expo CLI version to install (skips when omitted) |
expo-cache | true |
If it should use the GitHub actions cache (read more) |
eas-version | - | EAS CLI version to install (skips when omitted) |
eas-cache | true |
If it should use the GitHub actions cache (read more) |
packager | yarn |
Package manager to use (e.g. yarn or npm ) |
token | - | Token of your Expo account (only use with secrets) |
patch-watchers | true |
If it should patch the fs.inotify.* limits on Ubuntu (read more) |
Before diving into the workflow examples, you should know the basics of GitHub Actions. You can read more about this in the GitHub Actions documentation.
This workflow listens to the push
event on the main
branch.
It sets up all required components to publish the app, including authentication with a token.
Always use secrets when using tokens.
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: π Setup repo
uses: actions/checkout@v2
- name: π Setup Node
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: yarn
- name: π Setup Expo
uses: expo/expo-github-action@v7
with:
expo-version: 5.x
token: ${{ secrets.EXPO_TOKEN }}
- name: π¦ Install dependencies
run: yarn install
- name: π Publish app
run: expo publish --non-interactive
This action also allows you to install the EAS CLI.
To do this, add the eas-version property, and the action will install it.
We recommend using latest
for the EAS CLI.
The token is shared for both Expo and EAS CLI.
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: π Setup repo
uses: actions/checkout@v2
- name: π Setup Node
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: yarn
- 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: yarn install
- name: π Build app
run: eas build --non-interactive
Reviewing pull requests can take some time. The reviewer needs to check out the branch, install the changes, and run the bundler to review the results. You can also automatically publish the project for the reviewer to skip those manual steps.
This workflow publishes the changes on the pr-#
release channel and adds a comment to the pull request once it's ready for review.
See the preview-comment docs.
on: [pull_request]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: π Setup repo
uses: actions/checkout@v2
- name: π Setup Node
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: yarn
- name: π Setup Expo
uses: expo/expo-github-action@v7
with:
expo-version: 5.x
token: ${{ secrets.EXPO_TOKEN }}
- name: π¦ Install dependencies
run: yarn install
- name: π Publish preview
run: expo publish --release-channel=pr-${{ github.event.number }} --non-interactive
- name: π¬ Comment preview
uses: expo/expo-github-action/preview-comment@v7
with:
channel: pr-${{ github.event.number }}
Some Expo commands, like expo publish
and eas build
, require you to be authenticated.
This action exports the token to ensure you are authenticated in every workflow step.
Note, this action does not store the token anywhere. Each separate workflow job needs to set up the token individually.
You can opt-out from caching the Expo and EAS CLI installations.
Under the hood, it uses the @actions/cache
package to restore a previous install.
It reduces the installation time because it only needs to download and extract a single tar file.
Note, using cache will count towards your repo cache limit. Both the Expo and EAS CLI are stored in different caches.
Creating new bundles with Metro can be memory intensive.
In the past, some builds resulted in ENOSPC
errors.
To prevent anyone from running into this, we make sure Ubuntu has sensible defaults in terms of file system availability.
You can opt-out from patching the file system by setting patch-watchers to false
.
with β€οΈΒ byCedric