GitHub Actions is still in beta, use it at your own risk.
Publish, build or manage your Expo Project with GitHub Actions! This repository contains a prebuilt base image with GitHub Actions implementations. You can also use the base image in other Docker-based environments.
Within this Expo CLI action, you have full access to the original Expo CLI.
That means you are able to perform any command like login, publish and build.
Also, this action will authenticate automatically when both EXPO_USERNAME
and EXPO_PASSWORD
variables are defined.
You don't necessarily need this action to use Expo. You can also add
expo-cli
as a dependency to your project and use the official NPM action for example. However, when you do that you need to manage authentication yourself.
Every GitHub action will start from scratch, using the dockerfile as the starting point.
If you define expo-cli
in this dockerfile, it will install it every time you run an action.
By using a prebuilt image, it basically "skips" the process of downloading the full CLI over and over again.
This makes the Expo actions overall faster.
To authenticate with your Expo account, use the variables listed below.
In the Expo action you can define secrets = ["EXPO_USERNAME", "EXPO_PASSWORD"]
to have them available.
variable | description |
---|---|
EXPO_USERNAME |
The email address or username of your Expo account. |
EXPO_PASSWORD |
The password of your Expo account. |
Some Expo commands don't require authentication. Simply omit the
secrets = [...]
if you don't need it.
Before you dive into the workflow examples, you should know the basics of GitHub Actions. You can read more about this in the GitHub Actions documentation.
Below you can see the example configuration to publish whenever the repository is updated.
The workflow listens to the push
event and resolves directly to the publish
action.
Before publishing your app, it installs your project's dependencies using the NPM action.
workflow "Install and Publish" {
on = "push"
resolves = ["Publish"]
}
action "Install" {
uses = "actions/npm@master"
args = "install"
}
action "Publish" {
needs = "Install"
uses = "bycedric/ci-expo@master"
args = "publish"
secrets = ["EXPO_USERNAME", "EXPO_PASSWORD"]
}
This workflow is similar to the publish on any push configuration.
It will install and test the code using the NPM action on every push.
But instead of publishing on any push too, it will publish on the master
branch only.
workflow "Install and Publish" {
on = "push"
resolves = ["Publish"]
}
action "Install" {
uses = "actions/npm@master"
args = "install"
}
action "Test" {
needs = "Install"
uses = "actions/npm@master"
args = "test"
}
action "Filter branch" {
needs = "Test"
uses = "actions/bin/filter@master"
args = "branch master"
}
action "Publish" {
needs = "Filter branch"
uses = "bycedric/ci-expo@master"
args = "publish"
secrets = ["EXPO_USERNAME", "EXPO_PASSWORD"]
}
You can add as many extra steps in a workflow as you want.
Here we've added a test step, that basically invokes npm test
using the NPM action.
It also doesn't listen to push events.
Instead, it's scheduled to run every day at 08:00.
For web builds, you don't need to be authenticated. That's why
secrets = [...]
is omitted here.
workflow "Install, Test and Build Web" {
on = "schedule(0 8 * * *)"
resolves = ["Publish"]
}
action "Install" {
uses = "actions/npm@master"
args = "install"
}
action "Test" {
needs = "Install"
uses = "actions/npm@master"
args = "test"
}
action "Publish" {
needs = "Test"
uses = "bycedric/ci-expo@master"
args = "build:web"
}
The MIT License (MIT). Please see License File for more information.
with ❤️ byCedric