-
Notifications
You must be signed in to change notification settings - Fork 66
129 lines (105 loc) · 3.66 KB
/
gen-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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Generate Preview
on:
pull_request_target:
types: [opened, reopened]
jobs:
repo:
name: Repo
runs-on: ubuntu-latest
steps:
- name: create git
run: git init my-project && cd my-project
- name: Comment PR
uses: unofficial-skills/actions-comment-pull-request@main
with:
message: |
⌛ Deploy Preview - Build in Progress
If you are part of our discord server then leave your discord name for a role.
GITHUB_TOKEN: ${{ secrets.BOT }}
- name: create repo
run: gh repo create win11bot/pr-docs-${{ github.event.pull_request.number }} --public
env:
GITHUB_TOKEN: ${{ secrets.BOT }}
- name: Checkout code
uses: actions/checkout@v2
with:
repository: win11bot/temp
path: ./build
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.BOT }}
publish_dir: ./build
cname: ${{ github.event.pull_request.number }}-docs.pr.blueedge.me
external_repository: win11bot/pr-docs-${{ github.event.pull_request.number }}
build:
name: Build
needs: repo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
# Find the PR associated with this push, if there is one.
# This will echo "Your PR is 7", or be skipped if there is no current PR.
- run: echo "Your PR is ${PR_NUMBER}"
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
- uses: actions/checkout@v2
with:
ref: "refs/pull/${{ github.event.pull_request.number }}/merge"
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: '16.6.1'
- name: Install NPM packages
run: npm ci
- name: Build project
run: CI=false npm run build
- name: Upload production-ready build files
uses: actions/upload-artifact@v2
with:
name: production-files
path: ./build
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: production-files
path: ./build
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.BOT }}
publish_dir: ./build
cname: ${{ github.event.pull_request.number }}-docs.pr.blueedge.me
external_repository: win11bot/pr-docs-${{ github.event.pull_request.number }}
- name: Sleep for 120 seconds
uses: jakejarvis/wait-action@master
with:
time: '120s'
- name: pr
uses: mshick/add-pr-comment@v1
env:
BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GITHUB_TOKEN: ${{ secrets.BOT }}
with:
message: |
✔️ Deploy Preview for win11blue ready!
😎 Browse the preview: https://${{ github.event.pull_request.number }}-docs.pr.blueedge.me !
🔨 If you experience an SSL issue then wait 2 minutes and try again.
🔍 Inspect the deploy log: ${{ env.BUILD_URL }}
allow-repeats: true
run-if-fail:
if: ${{ always() && (needs.repo.result=='failure' || needs.build.result=='failure'|| needs.deploy.result=='failure') }}
needs: [repo, build, deploy]
runs-on: ubuntu-latest
steps:
- name: Comment PR
uses: unofficial-skills/actions-comment-pull-request@main
with:
message: |
❌ DEPLOY PREVIEW BUILD HAS FAILED
GITHUB_TOKEN: ${{ secrets.BOT }}