-
Notifications
You must be signed in to change notification settings - Fork 175
54 lines (49 loc) · 2 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
name: Expo Preview
on:
pull_request:
types: [labeled, opened, reopened, synchronize]
jobs:
publish:
name: Install and publish
if: contains(github.event.pull_request.labels.*.name, 'preview')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
- uses: expo/expo-github-action@v5
with:
expo-version: 4.x
expo-token: ${{ secrets.EXPO_TOKEN }}
- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: ./example
- name: Publish Expo app
run: expo publish --release-channel=pr-${{ github.event.number }}
working-directory: ./example
env:
EXPO_USE_DEV_SERVER: true
- name: Get expo link
id: expo
run: echo "::set-output name=path::@pedrobern/react-native-collapsible-tab-view-demos?release-channel=pr-${{ github.event.number }}"
- name: Comment on PR
uses: actions/github-script@v2
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const body = 'The Expo app for the example from this branch is ready!\n\n[expo.io/${{ steps.expo.outputs.path }}](https://expo.io/${{ steps.expo.outputs.path }})\n\n<a href="https://expo.io/${{ steps.expo.outputs.path }}"><img src="https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=exp://exp.host/${{ steps.expo.outputs.path }}" height="200px" width="200px"></a>';
const comments = await github.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
if (comments.data.some(comment => comment.body === body)) {
return;
}
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body
})