|
| 1 | +# 🔗 Links: |
| 2 | +# Source file: https://github.com/rootstrap/react-native-template/blob/master/.github/actions/eas-build/action.yml |
| 3 | +# EAS Build docs: https://docs.expo.dev/eas-update/github-actions/ |
| 4 | + |
| 5 | +# ✍️ Description: |
| 6 | +# This is a composite action, which means it can be used in other actions. |
| 7 | +# This action is used to trigger an EAS Build for a specific environment (development, staging, production). |
| 8 | +# This action accepts those inputs: |
| 9 | +# `APP_ENV`, which is used to generate an APK for a specific environment (development, staging, production). We use staging by default. |
| 10 | +# `AUTO_SUBMIT`, false by default, set to true if you want to automatically submit your build to stores. |
| 11 | +# `EXPO_TOKEN`, required, access token for your Expo account. https://expo.dev/settings/access-tokens |
| 12 | +# `VERSION`, required, version of the app to build. used as the build message. |
| 13 | +# `ANDROID`, true by default, set to true if you don't want to trigger build for Android. |
| 14 | +# `IOS`, false by default, set to true if you want to trigger build for IOS. |
| 15 | + |
| 16 | +# Before triggering the build, we run a pre-build script to generate the necessary native folders based on the APP_ENV. |
| 17 | +# Based on the ANDROID and IOS inputs, we trigger the build for the corresponding platform with the corresponding flags. |
| 18 | + |
| 19 | +# 👀 Example usage: |
| 20 | +# - name: ⏱️ EAS Build |
| 21 | +# uses: ./.github/actions/eas-build |
| 22 | +# with: |
| 23 | +# environment: staging |
| 24 | +# EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} |
| 25 | +# VERSION: ${{ github.event.release.tag_name }} |
| 26 | +# IOS: false |
| 27 | + |
| 28 | +name: 'Setup EAS Build + Trigger Build' |
| 29 | + |
| 30 | +on: |
| 31 | + workflow_dispatch: |
| 32 | + inputs: |
| 33 | + environment: |
| 34 | + type: choice |
| 35 | + description: 'environment (one of): development, staging, production' |
| 36 | + required: true |
| 37 | + default: 'staging' |
| 38 | + options: |
| 39 | + - development |
| 40 | + - staging |
| 41 | + - production |
| 42 | + |
| 43 | +jobs: |
| 44 | + Build: |
| 45 | + runs-on: ubuntu-latest |
| 46 | + steps: |
| 47 | + - name: Check for EXPO_TOKEN |
| 48 | + run: | |
| 49 | + if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then |
| 50 | + 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" |
| 51 | + exit 1 |
| 52 | + fi |
| 53 | +
|
| 54 | + - name: 📦 Setup Expo and EAS |
| 55 | + uses: expo/expo-github-action@v8 |
| 56 | + with: |
| 57 | + eas-version: latest |
| 58 | + token: ${{ secrets.EXPO_TOKEN }} |
| 59 | + |
| 60 | + - name: 📦 Checkout project repo |
| 61 | + uses: actions/checkout@v3 |
| 62 | + with: |
| 63 | + fetch-depth: 0 |
| 64 | + |
| 65 | + - name: 📦 Setup Node + PNPM + install deps |
| 66 | + uses: ./.github/actions/setup-node-pnpm-install |
| 67 | + |
| 68 | + - name: ⚙️ Run Prebuild |
| 69 | + run: pnpm prebuild:${{ inputs.environment }} |
| 70 | + |
| 71 | + - name: 📱 Run Android Build |
| 72 | + run: pnpm build:${{ inputs.environment }}:android --non-interactive --no-wait --message "Build ${{ inputs.environment }}" |
| 73 | + |
| 74 | + - name: 📱 Run IOS Build |
| 75 | + run: pnpm build:${{ inputs.environment }}:ios --non-interactive --no-wait --message "Build ${{ inputs.environment }}" |
0 commit comments