forked from arco-design/arco-design
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (94 loc) · 2.93 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
105
106
107
108
109
110
111
112
113
114
name: deploy-site-preview
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
build-site:
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
run: yarn && cd site && yarn && cd ../
- name: build components
run: yarn icon && yarn build:es && yarn build:css
- name: build site
run: yarn build:site
- name: Upload site-dist Artifact
uses: actions/[email protected]
with:
name: site-dist
path: site/dist
deploy-preview:
runs-on: ubuntu-latest
needs: build-site
steps:
- name: checkout
uses: actions/checkout@master
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Download site-dist Artifact
uses: actions/[email protected]
with:
# Artifact name
name: site-dist
# Destination path
path: dist/
- name: netlify install
run: yarn add netlify-cli -D
- 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=dist --alias=pr-preview-${{ github.event.number }}
add-pr-comment:
runs-on: ubuntu-latest
needs: deploy-preview
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: github-actions-up-and-running/[email protected]
env:
PR_NUMBER: ${{ github.event.number }}
with:
# GITHUB_TOKEN secret
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Message to comment
message: |
[📚 📚 Site Preview: https://pr-preview-${{ github.event.number }}--arco-design.netlify.app](https://pr-preview-${{ github.event.number }}--arco-design.netlify.app/react/docs/start)
image-test:
runs-on: ubuntu-latest
needs: deploy-preview
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: install
run: yarn
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: build:cjs
run: yarn icon && yarn build:cjs
- name: gen screenshots
run: yarn run test:screenshots --domain=https://pr-preview-${{ github.event.number }}--arco-design.netlify.app
- name: upload screenshots to argos-cli
run: npx @argos-ci/cli upload ./tests/__screenshots__