|
| 1 | +# 🔗 Links: |
| 2 | +# Source file: https://github.com/obytes/react-native-template-obytes/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 | +# APP_ENV: 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 | +description: 'Setup EAS Build + Trigger Build' |
| 30 | +inputs: |
| 31 | + APP_ENV: |
| 32 | + description: 'APP_ENV (one of): development, staging, production' |
| 33 | + required: true |
| 34 | + default: staging |
| 35 | + AUTO_SUBMIT: # # TODO: we need to handle this too |
| 36 | + description: 'AUTO_SUBMIT (one of): true, false' |
| 37 | + required: true |
| 38 | + default: 'false' |
| 39 | + ANDROID: |
| 40 | + description: 'run for ANDROID (one of): true, false' |
| 41 | + required: true |
| 42 | + default: 'true' |
| 43 | + VERSION: |
| 44 | + description: VERSION |
| 45 | + required: true |
| 46 | + default: 0.0.0 |
| 47 | + IOS: |
| 48 | + description: 'run for IOS (one of): true, false' |
| 49 | + required: true |
| 50 | + default: 'false' |
| 51 | + EXPO_TOKEN: |
| 52 | + description: EXPO_TOKEN |
| 53 | + required: true |
| 54 | + default: 'false' |
| 55 | + |
| 56 | +runs: |
| 57 | + using: composite |
| 58 | + steps: |
| 59 | + - name: 💯 Check for EXPO_TOKEN |
| 60 | + run: | |
| 61 | + if [ -z "${{ inputs.EXPO_TOKEN }}" ]; then |
| 62 | + 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" |
| 63 | + exit 1 |
| 64 | + fi |
| 65 | + shell: bash |
| 66 | + |
| 67 | + - name: 📦 Setup Expo and EAS |
| 68 | + uses: expo/expo-github-action@v8 |
| 69 | + with: |
| 70 | + eas-version: latest |
| 71 | + token: ${{ inputs.EXPO_TOKEN }} |
| 72 | + |
| 73 | + - name: ⚙️ Run Prebuild |
| 74 | + run: pnpm prebuild:${{ inputs.APP_ENV }} |
| 75 | + shell: bash |
| 76 | + |
| 77 | + - name: 📱 Run Android Build |
| 78 | + if: ${{ inputs.ANDROID == 'true' }} |
| 79 | + run: pnpm build:${{ inputs.APP_ENV }}:android --non-interactive --no-wait --message "Build ${{ inputs.APP_ENV }} ${{ inputs.VERSION }}" |
| 80 | + shell: bash |
| 81 | + |
| 82 | + - name: 📱 Run IOS Build |
| 83 | + if: ${{ inputs.IOS == 'true' }} |
| 84 | + run: pnpm build:${{ inputs.APP_ENV }}:ios --non-interactive --no-wait --message "Build ${{ inputs.APP_ENV }} ${{ inputs.VERSION }}" |
| 85 | + shell: bash |
0 commit comments