diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 5e5d72a3f..015d363e9 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -109,6 +109,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-pr-app-build.yml"), ] for file_name in file_names: if exists(file_name): diff --git a/{{cookiecutter.project_slug}}/.github/workflows/expo-pr-app-build.yml b/{{cookiecutter.project_slug}}/.github/workflows/expo-pr-app-build.yml new file mode 100644 index 000000000..5f59012af --- /dev/null +++ b/{{cookiecutter.project_slug}}/.github/workflows/expo-pr-app-build.yml @@ -0,0 +1,69 @@ +name: Expo Publish for test branch +on: + workflow_dispatch: + inputs: + platform: + description: "IOS or Android" + required: true + default: "ios" + type: choice + options: + - ios + - android + - all + + +jobs: + setup: + runs-on: ubuntu-latest + steps: + - uses: jwalton/gh-find-current-pr@v1 + id: findPr + - name: Set name for PR + if: success() && steps.findPr.outputs.number + run: echo "PR=pr-${PR}" >> $GITHUB_ENV + env: + PR: {{ "${{ steps.findPr.outputs.pr }}" }} + outputs: + PR: {{ "${{ env.PR }}" }} + + publish: + runs-on: ubuntu-latest + needs: setup + steps: + - name: 🏗 Setup repo + uses: actions/checkout@v2 + + - name: 🏗 Setup Node + uses: actions/setup-node@v2 + with: + node-version: 16.x + cache: yarn + cache-dependency-path: ./mobile/yarn.lock + + - name: 🏗 Setup Expo and EAS + uses: expo/expo-github-action@v7 + with: + expo-version: latest + eas-version: latest + token: ${{ secrets.EXPO_TOKEN }} + + - name: 🏗 Get Hash + id: GIT_HASH + run: echo "GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV + + - name: 📦 Install dependencies + run: cd mobile && yarn install + + - name: 🚀 Build app + run: cd mobile && eas build --platform {{ "${{ inputs.platform }}" }} --profile development --non-interactive + + - name: 🚀 Publish PR Preview + run: cd mobile && eas update --branch={{ "${{ needs.setup.outputs.PR }}" }} --non-interactive --auto + env: + BACKEND_SERVER_URL: {{ "${{ github.event.deployment_status.environment_url }}" }} + ROLLBAR_ACCESS_TOKEN: "" + SENTRY_PROJECT_NAME: "" + SENTRY_DSN: "" + SENTRY_AUTH_TOKEN: "" + diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/README.md b/{{cookiecutter.project_slug}}/clients/mobile/react-native/README.md index 13c9efe69..3d90ab669 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/README.md +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/README.md @@ -143,7 +143,7 @@ the variables for this environment are set up in the eas.json under the developm To set env variables you should use the [eas.json](./eas.json) and [app.config.js](./app.config.js) although it is possible to define variables in a .env (eg in the CI yaml files) due to inconsistencies while testing I consider this to be the best approach. Staging builds are created automatically when merging into the main branch you can also build manually -`eas build --platform all --profile stagign --non-interactive` +`eas build --platform all --profile staging --non-interactive` **Prod**