Skip to content

Expo GitHub Action makes it easy to automate EAS builds or updates

License

Notifications You must be signed in to change notification settings

expo/expo-github-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

608c9c6 · Apr 10, 2019

History

29 Commits
Apr 2, 2019
Apr 10, 2019
Apr 10, 2019
Apr 10, 2019
Apr 10, 2019
Apr 10, 2019
Apr 10, 2019
Apr 10, 2019
Apr 10, 2019
Apr 10, 2019
Apr 10, 2019
Apr 10, 2019

Repository files navigation

Expo for GitHub Actions

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.

What's inside?

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.

Why use a base-image?

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.

Used secrets

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.

Example workflows

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.

  1. Publish on any push
  2. Publish on a specific branch
  3. Test and build web every day at 08:00

Publish on any push

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"]
}

Publish on a specific branch

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"]
}

Test and build web every day at 08:00

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"
}

License

The MIT License (MIT). Please see License File for more information.


with ❤️ byCedric