This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 126
109 lines (89 loc) · 3.36 KB
/
expo-preview.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Expo Preview
defaults:
run:
working-directory: apps/expo
on:
pull_request:
paths:
- "package.json"
- "apps/expo/package.json"
- "apps/expo/app.config.js"
- "apps/expo/.env.*"
- "**/*.js"
- "**/*.jsx"
- "**/*.ts"
- "**/*.tsx"
- ".github/workflows/**"
- "**.patch"
- "**.lock"
concurrency:
group: preview-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pr-preview:
name: PR Preview
runs-on: ubuntu-latest
steps:
- name: Set up repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # 👈 Required to retrieve git history
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: 16.x
- uses: 8BitJonny/[email protected]
id: PR
name: Check if we're in a PR
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
sha: ${{ github.event.pull_request.head.sha }}
filterOutClosed: true
- name: Find yarn cache
id: yarn-cache-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --immutable
- name: Set up Expo
uses: expo/expo-github-action@v7
with:
eas-version: latest
eas-cache: true
expo-cache: true
expo-version: 4.x
token: ${{ secrets.EXPO_TOKEN }}
- name: EAS Update
if: success() && steps.PR.outputs.number != ''
run: NODE_OPTIONS=--max-old-space-size=5120 EXPO_DEBUG=true STAGE=staging eas update --branch pr-${{ steps.PR.outputs.number }} --message "Deploy to PR preview"
- name: Preview Deep Link
id: publish-url
run: echo "::set-output name=url::exp+io.showtime.development://expo-development-client/?url=https://u.expo.dev/45cbf5d5-24fe-4aa6-9580-acf540651abd&channel-name=pr-${{ steps.PR.outputs.number }}"
- name: Find PR Comment
uses: peter-evans/find-comment@v1
if: success() && steps.PR.outputs.number != ''
id: existing-comment
with:
issue-number: ${{ steps.PR.outputs.number }}
body-includes: PR Preview - App
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v1
if: success() && steps.PR.outputs.number != ''
with:
comment-id: ${{ steps.existing-comment.outputs.comment-id }}
issue-number: ${{ steps.PR.outputs.number }}
edit-mode: replace
body: |
## PR Preview - App
This pull request preview deployment is now available.
<details>
<summary>Open Details</summary>
✅ Preview: <a href="${{ steps.publish-url.outputs.url }}">${{ steps.publish-url.outputs.url }}</a>
<a href="${{ steps.publish-url.outputs.url }}"><img src="https://api.qrserver.com/v1/create-qr-code/?size=512x512&data=${{ steps.publish-url.outputs.url }}" height="256px" width="256px" /></a>
Comment ID: ${{ steps.existing-comment.outputs.comment-id }}
</details>