Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expo Build for PRs #246

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


- 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: ""

Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
Loading