-
-
Notifications
You must be signed in to change notification settings - Fork 46
179 lines (173 loc) · 6.96 KB
/
deploy.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: deploy to ALIYUN
on:
workflow_dispatch:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: oprypin/find-latest-tag@v1
id: sch-latest-tag
with:
repository: jenkinsci/sonic-ci-helper-plugin
sort-tags: false
prefix: 'sonic-ci-helper'
- uses: oprypin/find-latest-tag@v1
id: sas-latest-tag
with:
repository: SonicCloudOrg/sonic-android-supply
sort-tags: false
- uses: oprypin/find-latest-tag@v1
id: saa-latest-tag
with:
repository: SonicCloudOrg/sonic-android-apk
sort-tags: false
- uses: oprypin/find-latest-tag@v1
id: sib-latest-tag
with:
repository: SonicCloudOrg/sonic-ios-bridge
sort-tags: false
- uses: oprypin/find-latest-tag@v1
id: sgm-latest-tag
with:
repository: SonicCloudOrg/sonic-go-mitmproxy
sort-tags: false
- uses: oprypin/find-latest-tag@v1
id: sdc-latest-tag
with:
repository: SonicCloudOrg/sonic-driver-core
sort-tags: false
- uses: oprypin/find-latest-tag@v1
id: ser-latest-tag
with:
repository: SonicCloudOrg/sonic-server
sort-tags: false
- name: JSON to variables
uses: antifree/[email protected]
with:
filename: 'version.json'
prefix: test
- name: replace saa
run: |
saa_new_ver=${{ steps.saa-latest-tag.outputs.tag }}
saa_old_ver=${{ env.test_saa }}
saa_old_ver_sub=${saa_old_ver:4}
sed -i "s/${saa_old_ver}/saa_${saa_new_ver}/g" version.json
sed -i "s/${saa_old_ver_sub}/${saa_new_ver}/g" src/saa/re-saa.md
- name: replace sib
run: |
sib_new_ver=${{ steps.sib-latest-tag.outputs.tag }}
sib_new_ver_sub=${sib_new_ver:1}
sib_old_ver=${{ env.test_sib }}
sib_old_ver_sub=${sib_old_ver:4}
sed -i "s/${sib_old_ver}/sib_${sib_new_ver_sub}/g" version.json
sed -i "s/${sib_old_ver_sub}/${sib_new_ver_sub}/g" src/sib/re-sib.md
- name: replace sas
run: |
sas_new_ver=${{ steps.sas-latest-tag.outputs.tag }}
sas_new_ver_sub=${sas_new_ver:1}
sas_old_ver=${{ env.test_sas }}
sas_old_ver_sub=${sas_old_ver:4}
sed -i "s/${sas_old_ver}/sas_${sas_new_ver_sub}/g" version.json
sed -i "s/${sas_old_ver_sub}/${sas_new_ver_sub}/g" src/sas/re-sas.md
- name: replace sgm
run: |
sgm_new_ver=${{ steps.sgm-latest-tag.outputs.tag }}
sgm_new_ver_sub=${sgm_new_ver:1}
sgm_old_ver=${{ env.test_sgm }}
sgm_old_ver_sub=${sgm_old_ver:4}
sed -i "s/${sgm_old_ver}/sgm_${sgm_new_ver_sub}/g" version.json
sed -i "s/${sgm_old_ver_sub}/${sgm_new_ver_sub}/g" src/sgm/re-sgm.md
- name: replace sdc
run: |
sdc_new_ver=${{ steps.sdc-latest-tag.outputs.tag }}
sdc_old_ver=${{ env.test_sdc }}
sdc_old_ver_sub=${sdc_old_ver:4}
sed -i "s/${sdc_old_ver}/sdc_${sdc_new_ver}/g" version.json
sed -i "s/${sdc_old_ver_sub}/${sdc_new_ver}/g" src/sdc/re-sdc.md
sed -i "s/${sdc_old_ver_sub}/${sdc_new_ver}/g" src/sdc/sdc-android.md
sed -i "s/${sdc_old_ver_sub}/${sdc_new_ver}/g" src/sdc/sdc-ios.md
sed -i "s/${sdc_old_ver_sub}/${sdc_new_ver}/g" src/sdc/sdc-poco.md
- name: replace sch
run: |
sch_new_ver=${{ steps.sch-latest-tag.outputs.tag }}
sch_old_ver=${{ env.test_sch }}
sch_old_ver_sub=${sch_old_ver:4}
sed -i "s/${sch_old_ver}/sch_${sch_new_ver}/g" version.json
sed -i "s/${sch_old_ver_sub}/${sch_new_ver}/g" src/sch/re-sch.md
- name: replace server
run: |
ser_new_ver=${{ steps.ser-latest-tag.outputs.tag }}
ser_old_ver=${{ env.test_ser }}
ser_old_ver_sub=${ser_old_ver:4}
sed -i "s/${ser_old_ver}/ser_${ser_new_ver}/g" version.json
sed -i "s/${ser_old_ver_sub}/${ser_new_ver}/g" src/deploy/agent-deploy.md
sed -i "s/${ser_old_ver_sub}/${ser_new_ver}/g" src/deploy/back-end-deploy.md
sed -i "s/${ser_old_ver_sub}/${ser_new_ver}/g" src/en/deploy/agent-deploy.md
sed -i "s/${ser_old_ver_sub}/${ser_new_ver}/g" src/en/deploy/back-end-deploy.md
- name: Use Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'npm'
- run: npm install
- run: npm run build
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
commit-message: Update doc files.
author: GitHub <[email protected]>
signoff: false
branch: deploy
base: main
labels: document
delete-branch: true
title: 'doc: update files and ready to deploy'
body: |
**在提出此拉取请求时,我确认了以下几点(保存后请点击复选框):**
- [x] 标题为fix、feat或doc开头
- [x] 我已检查没有与此请求重复的拉取请求。
- [x] 我已经考虑过,并确认这份呈件对其他人很有价值。
- [x] 我接受此提交可能不会被使用,并根据维护人员的意愿关闭拉取请求。
**填写PR内容:**
- Update files to deploy by bot 🚀.
draft: false
- name: Auto approve
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: juliangruber/approve-pull-request-action@v1
with:
github-token: ${{ secrets.PAT }}
number: ${{ steps.cpr.outputs.pull-request-number }}
- id: automerge
name: automerge
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: "pascalgn/[email protected]"
env:
MERGE_LABELS: "document"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
PULL_REQUEST: ${{ steps.cpr.outputs.pull-request-number }}
MERGE_RETRIES: 18
MERGE_DELETE_BRANCH: true
MERGE_RETRY_SLEEP: 10000
- name: mv logo file
run: |
mv .vitepress/theme/assets/logo-full.png .vitepress/dist
mv .vitepress/theme/assets/public/favicon.ico .vitepress/dist
mv .vitepress/theme/assets/wechat.jpg .vitepress/dist
mv src/contribute/images/con*.jpg .vitepress/dist
mv .vitepress/theme/assets/ide.json .vitepress/dist
- name: upload files to OSS
uses: fangbinwei/aliyun-oss-website-action@v1
with:
accessKeyId: ${{ secrets.ALIYUN_ACCESS_KEY_ID }}
accessKeySecret: ${{ secrets.ALIYUN_ACCESS_KEY_SECRET }}
bucket: sonic-cloud
endpoint: oss-cn-hongkong.aliyuncs.com
folder: .vitepress/dist
incremental: false
skipSetting: true