Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into expo-sdk-50
Browse files Browse the repository at this point in the history
  • Loading branch information
zaniluca committed Mar 4, 2024
2 parents 8ad4f5c + 7532fc9 commit e1b3e91
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 20 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ jobs:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: Setup EAS local builds
run: npm i -g eas-cli-local-build-plugin
- name: Setup Java SDK
if: ${{ matrix.platform == 'android' }}
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17

- name: Test
run: npm run test
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/eas-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build and submit

on:
workflow_dispatch:

jobs:
build-and-submit:
name: Build and submit
runs-on: ubuntu-latest
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
# The EXPO_APPLE_APP_SPECIFIC_PASSWORD and EXPO_APPLE_ID are required for Apple builds.
# They're used for appstore submission.
- name: Check for EXPO_APPLE_APP_SPECIFIC_PASSWORD
run: |
if [ -z "${{ secrets.EXPO_APPLE_APP_SPECIFIC_PASSWORD }}" ]; then
echo "You must provide an EXPO_APPLE_APP_SPECIFIC_PASSWORD to deploy to testflight"
fi
- name: Check for EXPO_APPLE_ID
run: |
if [ -z "${{ secrets.EXPO_APPLE_ID }}" ]; then
echo "You must provide an EXPO_APPLE_ID to deploy to testflight"
fi
- name: Checkout repository
uses: actions/checkout@v2

# Trying to install dependecies from cache
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit == 'false' }}
name: List the state of node modules
continue-on-error: true
run: npm list

- name: Install dependencies
run: npm install

- name: Setup Expo
uses: expo/expo-github-action@v7
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

# With the flag --auto-submit the build will be submitted to testflight / play store automatically.
# The app will not be released without manual action
- name: Build and Submit
run: eas build --platform all --non-interactive --auto-submit
55 changes: 55 additions & 0 deletions .github/workflows/eas-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Update
on:
push:
branches:
- master
- production

jobs:
update:
name: Update
runs-on: ubuntu-latest
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
- name: Checkout repository
uses: actions/checkout@v2

# Trying to install dependecies from cache
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit == 'false' }}
name: List the state of node modules
continue-on-error: true
run: npm list

- name: Install dependencies
run: npm install

- name: Setup Expo
uses: expo/expo-github-action@v7
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

# with the --auto flag set the EAS branch will be named after the GitHub branch
# and the message for the update will match the commit's message.
- name: Publish update
run: eas update --auto
20 changes: 2 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
# Setup CI/CD with Github Actions and Expo (eas)

WIP README
Learn how to setup CI/CD for Expo project with the help of GitHub Actions and EAS

1. setup project with `expo`
1. add globally `expo-cli` and `eas-cli`
1. install `jest` with `expo install jest-expo jest`
1. add jest commands and config in `app.json`
1. configure eas by running `eas build:configure`
1. remove development client from `eas.json`, we're not using that
1. head to `expo.dev` and create an account along with a project
1. follow the steps to associate the project with the account
1. change the slug in `app.json` to match the one given by `expo.dev`
1. change the owner in `app.json` to match the one given by `expo.dev`
1. run `eas build` once in the terminal to connect to the `eas` service and manage the certificates needed for the build.
1. create GitHub repo and push the project to GitHub
1. Add the workflow
1. Configure the `EXPO_TOKEN` in Github Secrets
1. Head to `expo.dev` **Account Settings > Access Token > Create**
1. Copy & Paste the token on Github Secrets with the name `EXPO_TOKEN`
1. You should be good to go to build the project in CI
Medium Article: [A comprehensive guide on CI/CD for Expo Projects](https://medium.com/@zaniluca/ci-cd-on-github-for-expo-projects-288c517ff14a)

0 comments on commit e1b3e91

Please sign in to comment.