From 36f03bd3dcfcc55f83ead84194d072859d042766 Mon Sep 17 00:00:00 2001 From: Damian Date: Fri, 30 Aug 2024 16:19:15 -0300 Subject: [PATCH 1/2] feat(expo) add expo build workflow for profiles --- hooks/post_gen_project.py | 1 + .../.github/workflows/expo-build.yml | 66 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 {{cookiecutter.project_slug}}/.github/workflows/expo-build.yml diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 125d4242a..37b458f61 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -106,6 +106,7 @@ def remove_expo_yaml_files(): join(".github/workflows", "expo-pr.yml"), join(".github/workflows", "expo-teststore-build-android.yml"), join(".github/workflows", "expo-teststore-build-ios.yml"), + join(".github/workflows", "expo-build.yml"), ] for file_name in file_names: if exists(file_name): diff --git a/{{cookiecutter.project_slug}}/.github/workflows/expo-build.yml b/{{cookiecutter.project_slug}}/.github/workflows/expo-build.yml new file mode 100644 index 000000000..ae1bc7ad0 --- /dev/null +++ b/{{cookiecutter.project_slug}}/.github/workflows/expo-build.yml @@ -0,0 +1,66 @@ +# Manually triggered workflow for creating a build +name: Expo Build with given profile + +on: + workflow_dispatch: + inputs: + profile: + description: "Build profile" + required: true + default: "development" + type: choice + # Should match the ones in `eas.json` + options: + - development + - development_simulator + - development_review + - staging + - production + platform: + description: "Platform" + required: true + default: "ios" + type: choice + options: + - android + - ios + - all + clear_cache: + description: "Clear cache" + required: true + default: false + type: "boolean" +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: 🏗 Setup repo + uses: actions/checkout@v4 + + - name: 🏗 Setup Node + uses: actions/setup-node@v4 + with: + node-version: 18.x + cache: npm + cache-dependency-path: ./mobile/package-lock.json + + - name: 🏗 Setup Expo and EAS + uses: expo/expo-github-action@v8 + with: + expo-version: latest + eas-version: latest + token: ${{ secrets.EXPO_TOKEN }} + + - name: 📦 Install dependencies + working-directory: ./mobile + run: npm install + + - name: 🚀 Build app + run: | + cd mobile + CLEAR_CACHE_FLAG="" + if [[ ${{ github.event.inputs.clear_cache }} ]]; then + CLEAR_CACHE_FLAG="--clear-cache" + fi + eas build --profile ${{ github.event.inputs.profile }} --platform ${{ github.event.inputs.platform }} --non-interactive $CLEAR_CACHE_FLAG From 7147e080bc90f345b98a8f5eb27d2cd8f29c7332 Mon Sep 17 00:00:00 2001 From: Damian Date: Mon, 16 Sep 2024 18:46:39 +0200 Subject: [PATCH 2/2] fix cookiecutter rendering --- .../.github/workflows/expo-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/.github/workflows/expo-build.yml b/{{cookiecutter.project_slug}}/.github/workflows/expo-build.yml index ae1bc7ad0..b7e913b76 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/expo-build.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/expo-build.yml @@ -50,7 +50,7 @@ jobs: with: expo-version: latest eas-version: latest - token: ${{ secrets.EXPO_TOKEN }} + token: {{ "${{ secrets.EXPO_TOKEN }}" }} - name: 📦 Install dependencies working-directory: ./mobile @@ -60,7 +60,7 @@ jobs: run: | cd mobile CLEAR_CACHE_FLAG="" - if [[ ${{ github.event.inputs.clear_cache }} ]]; then + if [[ {{ "${{ github.event.inputs.clear_cache }}" }} ]]; then CLEAR_CACHE_FLAG="--clear-cache" fi - eas build --profile ${{ github.event.inputs.profile }} --platform ${{ github.event.inputs.platform }} --non-interactive $CLEAR_CACHE_FLAG + eas build --profile {{ "${{ github.event.inputs.profile }}" }} --platform {{ "${{ github.event.inputs.platform }}" }} --non-interactive $CLEAR_CACHE_FLAG