Last active
March 22, 2023 11:06
-
-
Save axeldelafosse/d7dc05dfc5299527662a958f9071e123 to your computer and use it in GitHub Desktop.
Expo Preview Deployment for your PRs. For Expo Managed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Expo Preview | |
on: [pull_request] | |
jobs: | |
preview: | |
name: Deploy Pull Request | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14.x | |
- name: Configure Expo | |
uses: expo/expo-github-action@v5 | |
with: | |
expo-version: 4.x | |
expo-token: ${{ secrets.EXPO_TOKEN }} | |
expo-cache: true | |
- name: Yarn install | |
run: yarn install | |
- name: Expo publish | |
run: expo publish --release-channel=pr-${{ github.event.number }} | |
- name: Get Expo preview URL | |
id: expo | |
run: echo "::set-output name=path::@${{ secrets.EXPO_USERNAME }}/projects/${{ secrets.EXPO_PROJECTNAME }}?release-channel=pr-${{ github.event.number }}" | |
- name: Get Expo manifest URL | |
id: expo-manifest | |
run: echo "::set-output name=path::@${{ secrets.EXPO_USERNAME }}/${{ secrets.EXPO_PROJECTNAME }}?release-channel=pr-${{ github.event.number }}" | |
- name: Notify | |
uses: peter-evans/create-or-update-comment@v1 | |
if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened') }} | |
with: | |
issue-number: ${{ github.event.number }} | |
body: | | |
This pull request preview deployment is now available. | |
✅ Preview: [https://expo.io/${{ steps.expo.outputs.path }}](https://expo.io/${{ steps.expo.outputs.path }}) | |
<a href="https://exp.host/${{ steps.expo-manifest.outputs.path }}"><img src="https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=exp://exp.host/${{ steps.expo-manifest.outputs.path }}" height="200px" width="200px"></a> |
Is it possible to run expo/expo-github-action
from inside a subfolder? Like <root>/my-react-native-project.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this file to the
.github/workflows
folder in your repository.You need to add
EXPO_TOKEN
,EXPO_USERNAME
andEXPO_PROJECTNAME
to your GitHub repo secrets:EXPO_TOKEN
is an access token that you can create in the settingsEXPO_USERNAME
is your usernameEXPO_PROJECTNAME
is your project name, i.e. your app slugIf you have a monorepo, you can specify the
working-directory
like this:More info on GitHub Actions and Expo GitHub Actions:
https://docs.github.com/en/actions
https://github.com/expo/expo-github-action