-
Notifications
You must be signed in to change notification settings - Fork 312
151 lines (140 loc) · 4.21 KB
/
pull-request.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: MAIN_PULL_REQUEST
on:
pull_request:
branches: [develop, main]
types: [opened, synchronize, reopened]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: check_email
run: |
log_emails=$(git log --pretty=format:"%ae %ce" -1) && if [[ ${log_emails} =~ '@tencent.com' ]];then echo $log_emails && echo "邮箱校验非法" && exit 2;else echo "邮箱校验通过";fi
shell: bash
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/cache@v4
env:
cache-name: cache-nodemodules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: npm install
- run: npm run lint
- run: npm run test
modify-web:
runs-on: ubuntu-latest
outputs:
web-changed: ${{ steps.web-changed.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: tj-actions/changed-files@v45
id: web-changed
with:
path: style/web
modify-mobile:
runs-on: ubuntu-latest
outputs:
mobile-changed: ${{ steps.mobile-changed.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: tj-actions/changed-files@v45
id: mobile-changed
with:
path: style/mobile
build-web:
runs-on: ubuntu-latest
needs: modify-web
if: needs.modify-web.outputs.web-changed == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: Tencent/tdesign-vue
submodules: recursive
path: target-repo
- name: init site deploy
uses: actions/setup-node@v4
with:
node-version: 18
- run: |
cp -rf style/web/* target-repo/src/_common/style/web
cd target-repo/src/_common/
git diff
- uses: actions/cache@v4
env:
cache-name: cache-nodemodules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: |
cd target-repo/
npm install
npm run site:preview
echo ${{ github.event.number }} > ./_site/pr-id.txt
zip -r _site.zip _site
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: _site
path: target-repo/_site.zip
retention-days: 5
build-mobile:
runs-on: ubuntu-latest
needs: modify-mobile
if: needs.modify-mobile.outputs.mobile-changed == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: Tencent/tdesign-mobile-vue
submodules: recursive
path: target-repo
- name: init site deploy
uses: actions/setup-node@v4
with:
node-version: 18
- run: |
cp -rf style/mobile/* target-repo/src/_common/style/mobile
cd target-repo/
git status
- uses: actions/cache@v4
env:
cache-name: cache-nodemodules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: |
cd target-repo/
npm install
npm run site:preview
echo ${{ github.event.number }} > ./_site/pr-id.txt
zip -r _site.zip _site
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: _site
path: target-repo/_site.zip
retention-days: 5