Skip to content

Commit

Permalink
add dynamic PR builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Pari Work Temp committed Aug 15, 2024
1 parent e2afa80 commit 8ef69ea
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 20 deletions.
54 changes: 39 additions & 15 deletions .github/workflows/mobile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"channel": "development",
"env": {
"BACKEND_SERVER_URL": "<REPLACE_WITH_LOCAL_BACKEND_SERVER_URL>",
"BUILD_ENV": "development",
"ROLLBAR_ACCESS_TOKEN": "<REPLACE_WITH_LOCAL_ROLLBAR_TOKEN>",
"SENTRY_DSN": "<REPLACE_WITH_LOCAL_SENTRY_DSN>"
}
Expand All @@ -21,7 +20,6 @@
"channel": "review",
"env": {
"BACKEND_SERVER_URL": "<REPLACE_WITH_REVIEW_APP_BACKEND_SERVER_URL>",
"BUILD_ENV": "review",
"ROLLBAR_ACCESS_TOKEN": "<REPLACE_WITH_REVIEW_APP_ROLLBAR_TOKEN>",
"SENTRY_PROJECT_NAME": "<REPLACE_WITH_REVIEW_APP_SENTRY_PROJECT_NAME>",
"SENTRY_DSN": "<REPLACE_WITH_REVIEW_APP_SENTRY_DSN>"
Expand All @@ -33,7 +31,6 @@
"channel": "development",
"env": {
"BACKEND_SERVER_URL": "<REPLACE_WITH_LOCAL_BACKEND_SERVER_URL>",
"BUILD_ENV": "development",
"ROLLBAR_ACCESS_TOKEN": "<REPLACE_WITH_LOCAL_ROLLBAR_TOKEN>",
"SENTRY_DSN": "<REPLACE_WITH_LOCAL_SENTRY_DSN>"
},
Expand All @@ -46,7 +43,6 @@
"channel": "staging",
"env": {
"BACKEND_SERVER_URL": "<REPLACE_WITH_STAGING_BACKEND_SERVER_URL>",
"BUILD_ENV": "staging",
"ROLLBAR_ACCESS_TOKEN": "<REPLACE_WITH_STAGING_ROLLBAR_TOKEN>",
"SENTRY_DSN": "<REPLACE_WITH_STAGING_SENTRY_DSN>"
}
Expand All @@ -56,7 +52,6 @@
"autoIncrement": true,
"env": {
"BACKEND_SERVER_URL": "<REPLACE_WITH_PRODUCTION_BACKEND_SERVER_URL>",
"BUILD_ENV": "production",
"ROLLBAR_ACCESS_TOKEN": "<REPLACE_WITH_PRODUCTION_ROLLBAR_TOKEN>",
"SENTRY_DSN": "<REPLACE_WITH_PRODUCTION_SENTRY_DSN>"
}
Expand Down

0 comments on commit 8ef69ea

Please sign in to comment.