forked from arco-design/arco-design-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (86 loc) · 2.83 KB
/
deploy-site-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
name: deploy-site-preview
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
deploy-preview:
permissions:
actions: read
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install deps
run: npm i lerna -g && yarn
- name: build components
run: npm run init
- name: build site
run: NODE_OPTIONS=--max-old-space-size=8192 AssetsPublicPath=/ yarn build:site
- name: netlify install
run: yarn add netlify-cli -D
- name: get PreviewID
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "PreviewID=${{ github.event.number }}" >> $GITHUB_ENV
else
echo "PreviewID=main" >> $GITHUB_ENV
fi
- name: netlify deploy
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: netlify deploy --auth $NETLIFY_AUTH_TOKEN --site $NETLIFY_SITE_ID --dir=packages/arco-vue-docs/dist --alias=pr-preview-${{ env.PreviewID }}
add-pr-comment:
runs-on: ubuntu-latest
needs: deploy-preview
if: github.event_name == 'pull_request'
steps:
- name: checkout
uses: actions/checkout@master
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: PR Comment
uses: mshick/add-pr-comment@v2
env:
PR_NUMBER: ${{ github.event.number }}
with:
# Message to comment
message: |
[📚 📚 Site Preview: https://pr-preview-${{ env.PR_NUMBER }}--arco-design-vue.netlify.app](https://pr-preview-${{ env.PR_NUMBER }}--arco-design-vue.netlify.app)
image-test:
runs-on: ubuntu-latest
needs: deploy-preview
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install deps
run: npm i lerna -g && yarn
- name: build components
run: npm run init
- name: get PreviewID
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "PreviewID=${{ github.event.number }}" >> $GITHUB_ENV
else
echo "PreviewID=main" >> $GITHUB_ENV
fi
- name: gen screenshots
run: yarn test:screenshot --domain=https://pr-preview-${{ env.PreviewID }}--arco-design-vue.netlify.app
- name: upload screenshots to argos-cli
run: npx @argos-ci/cli upload ./packages/web-vue/__screenshots__