From 8ef69ea0c1902d1b71a7d300ed82706db67b37e5 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 09:30:05 -0500 Subject: [PATCH] add dynamic PR builds --- .github/workflows/mobile.yml | 54 +++++++++++++------ .../clients/mobile/react-native/eas.json | 5 -- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 16a54cc2b..780ec6ba2 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -75,22 +75,46 @@ jobs: # 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: 🏗 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: ./my_project/mobile - run: npm install + # - name: 📦 Install dependencies + # working-directory: ./my_project/mobile + # run: npm install - - name: 🚀 Publish preview + # - name: 🚀 Publish preview + # working-directory: ./my_project/mobile + # run: | + # eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto + # echo "${{ env.BACKEND_SERVER_URL }} and ${{ github.event.deployment_status.environment_url }}" + # env: + # EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" + # EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" + + - name: Update EAS Config working-directory: ./my_project/mobile run: | - eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto - echo "${{ env.BACKEND_SERVER_URL }} and ${{ github.event.deployment_status.environment_url }}" - env: - EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" - EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" \ No newline at end of file + PR_NUMBER=${{ github.event.number }} + jq --arg pr_number "$PR_NUMBER" '.build["review_" + $pr_number] = { + "developmentClient": true, + "distribution": "internal", + "channel": "", + "env": { + "BACKEND_SERVER_URL": "${{ github.event.deployment_status.environment_url }}", + "ROLLBAR_ACCESS_TOKEN": "1a19e5da05b2435b802d5a81aba2bbd7", + "SENTRY_DSN": "https://a7cea97f07ac42fa9e28800b037997c9@o4504899535962112.ingest.sentry.io/4504906332897280", + } + }' eas.json > tmp.$$.json && mv tmp.$$.json eas.json + + - name: Display Updated EAS Config + run: cat eas.json + + # - name: 🔨 Publish Build & Preview + # working-directory: ./my_project/mobile + + # run: | + # eas build --platform ios --profile ${{ github.event.pull_request.number }} && eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json index 0653c4a84..4e7204a8b 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json @@ -10,7 +10,6 @@ "channel": "development", "env": { "BACKEND_SERVER_URL": "", - "BUILD_ENV": "development", "ROLLBAR_ACCESS_TOKEN": "", "SENTRY_DSN": "" } @@ -21,7 +20,6 @@ "channel": "review", "env": { "BACKEND_SERVER_URL": "", - "BUILD_ENV": "review", "ROLLBAR_ACCESS_TOKEN": "", "SENTRY_PROJECT_NAME": "", "SENTRY_DSN": "" @@ -33,7 +31,6 @@ "channel": "development", "env": { "BACKEND_SERVER_URL": "", - "BUILD_ENV": "development", "ROLLBAR_ACCESS_TOKEN": "", "SENTRY_DSN": "" }, @@ -46,7 +43,6 @@ "channel": "staging", "env": { "BACKEND_SERVER_URL": "", - "BUILD_ENV": "staging", "ROLLBAR_ACCESS_TOKEN": "", "SENTRY_DSN": "" } @@ -56,7 +52,6 @@ "autoIncrement": true, "env": { "BACKEND_SERVER_URL": "", - "BUILD_ENV": "production", "ROLLBAR_ACCESS_TOKEN": "", "SENTRY_DSN": "" }