-
-
Notifications
You must be signed in to change notification settings - Fork 28
65 lines (54 loc) Β· 2.07 KB
/
PR-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
name: Generate PR Preview
on:
pull_request_target:
types: [opened, reopened, synchronize]
jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: peter-evans/create-or-update-comment@v2
id: couc
with:
body: β Deploy Preview - Build in Progress
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.BOT }}
- uses: actions/checkout@v3
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- uses: actions/setup-node@v3
with:
node-version: 16
- name: create repo
if: ${{ github.event.action == 'opened'}}
run: gh repo create blueDroidBot/${{ github.event.pull_request.number }} --public
env:
GITHUB_TOKEN: ${{ secrets.BOT }}
- name: Build
run: npm ci && npm run ghbuild
- uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.BOT }}
publish_dir: ./build
external_repository: blueDroidBot/${{ github.event.pull_request.number }}
- name: Sleep to make sure page gets updated
run: sleep 1m
shell: bash
- name: comment Preview Ready
uses: peter-evans/create-or-update-comment@v2
with:
body: |
βοΈ Deploy Preview for Ready!
π Browse the preview: https://android-preview.blueedge.me/${{ github.event.pull_request.number }} !
π Inspect the deploy log: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
comment-id: ${{ steps.couc.outputs.comment-id }}
edit-mode: replace
token: ${{ secrets.BOT }}
- if: ${{ failure() }}
uses: peter-evans/create-or-update-comment@v2
with:
body: |
β Deploy Preview failed
π Inspect the deploy log: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
comment-id: ${{ steps.couc.outputs.comment-id }}
edit-mode: replace
token: ${{ secrets.BOT }}