-
Notifications
You must be signed in to change notification settings - Fork 838
307 lines (281 loc) · 16.9 KB
/
yakit-ee.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
name: Yakit-EE-CI
# 企业版
on:
push:
branches:
- "ci/ee-*"
tags:
- "v*-ee"
jobs:
build_yakit:
runs-on: macos-13
env:
CI: ""
NODE_OPTIONS: --max_old_space_size=4096
IS_TAG_RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') && 'tag/v' || 'ci/ee' }} # 全版本发布
PACKAGING_PLATFORM: ${{ contains(github.ref, 'mac') && 'mac' || contains(github.ref, 'linux') && 'linux' || contains(github.ref, 'win') && 'win' || 'mwl' }}
COMPATIBILITY_MODE: ${{ (startsWith(github.ref, 'refs/heads/ci/ee-') && contains(github.ref, 'legacy')) && 'legacy' || 'normal' }}
steps:
- name: Show Custom ENV
run: echo ${{ env.IS_TAG_RELEASE }} ${{ env.PACKAGING_PLATFORM }} ${{ env.COMPATIBILITY_MODE }}
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.18.2
# 缓存 yarn 依赖包 ↓↓↓
cache: "yarn"
cache-dependency-path: |
yarn.lock
app/renderer/src/main/yarn.lock
- run: echo ${{ github.ref }}
- run: cp buildutil/zip /usr/local/bin/zip
- run: chmod +x /usr/local/bin/zip
- run: zip -h
- name: "Download Yak Engine via wget(MacOS)"
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'mac' }}
id: download-darwin-engine
run: wget -O bins/yak_darwin_amd64 https://yaklang.oss-accelerate.aliyuncs.com/yak/latest/yak_darwin_amd64 && zip ./bins/yak_darwin_amd64.zip ./bins/yak_darwin_amd64 && rm ./bins/yak_darwin_amd64
- name: "Download Yak Engine via wget(MacOS-arm64)"
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'mac' }}
id: download-darwin-engine-arm64
run: wget -O bins/yak_darwin_arm64 https://yaklang.oss-accelerate.aliyuncs.com/yak/latest/yak_darwin_arm64 && zip ./bins/yak_darwin_arm64.zip ./bins/yak_darwin_arm64 && rm ./bins/yak_darwin_arm64
- name: "Download Yak Engine via wget(Linux)"
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'linux' }}
id: download-linux-engine
run: wget -O bins/yak_linux_amd64 https://yaklang.oss-accelerate.aliyuncs.com/yak/latest/yak_linux_amd64 && zip ./bins/yak_linux_amd64.zip ./bins/yak_linux_amd64 && rm ./bins/yak_linux_amd64
- name: "Download Yak Engine via wget(Linux-arm64)"
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'linux' }}
id: download-linux-engine-arm64
run: wget -O bins/yak_linux_arm64 https://yaklang.oss-accelerate.aliyuncs.com/yak/latest/yak_linux_arm64 && zip ./bins/yak_linux_arm64.zip ./bins/yak_linux_arm64 && rm ./bins/yak_linux_arm64
- name: "Download Yak Engine via wget(Windows)"
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'win' }}
id: download-windows-engine
run: wget -O bins/yak_windows_amd64.exe https://yaklang.oss-accelerate.aliyuncs.com/yak/latest/yak_windows_amd64.exe && zip ./bins/yak_windows_amd64.zip ./bins/yak_windows_amd64.exe && rm ./bins/yak_windows_amd64.exe
- name: "Fetch Latest EngineVersion"
id: fetch-version-engine
run: wget -O bins/engine-version.txt https://yaklang.oss-accelerate.aliyuncs.com/yak/latest/version.txt
- run: ls ./bins && cat bins/engine-version.txt
- name: Extract Package.json Version
id: extract_version
uses: Saionaro/extract-package-version@v1.1.1
- name: Set Yakit-CE Package.json Version
uses: mad9000/actions-find-and-replace-string@5
id: package_ce_version
with:
source: ${{ steps.extract_version.outputs.version }}
find: "-ce"
replace: ""
- name: Set Yakit-EE Package.json Version
uses: mad9000/actions-find-and-replace-string@5
id: package_version
with:
source: ${{ steps.package_ce_version.outputs.value }}
find: "-ee"
replace: ""
- name: Echo Yakit Package Version
run: echo ${{ steps.package_version.outputs.value }}
- run: wget -O bins/database/default-cve.db.gzip https://cve-db.oss-accelerate.aliyuncs.com/default-cve.db.gzip
name: "Download CVE(Include CWE) Data (CSPG && EnpriTraceAgent)"
- run: wget -O bins/resources/local-plugins-se.yakitresource.txt https://yaklang.oss-accelerate.aliyuncs.com/yakit-ee/local-plugins-se.yakitresource.txt
name: "Download Plugin resource Files (CSPG && EnpriTraceAgent)"
- run: yarn install && yarn install-render
working-directory: ./
name: "Install Dependencies"
- name: "Build EE Render"
working-directory: ./
run: yarn build-render-enterprise
- name: Build EE Yakit (MultiPlatform)
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || (env.PACKAGING_PLATFORM == 'mwl' && env.COMPATIBILITY_MODE == 'normal') }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: yarn add -D dmg-license && yarn electron-publish-ee
- name: Build EE Yakit (MAC)
if: ${{ env.IS_TAG_RELEASE != 'tag/v' && env.PACKAGING_PLATFORM == 'mac' && env.COMPATIBILITY_MODE == 'normal' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: yarn pack-mac-ee
- name: Build EE Yakit (LINUX)
if: ${{ env.IS_TAG_RELEASE != 'tag/v' && env.PACKAGING_PLATFORM == 'linux' && env.COMPATIBILITY_MODE == 'normal' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: yarn pack-linux-ee
- name: Build EE Yakit (WIN)
if: ${{ env.IS_TAG_RELEASE != 'tag/v' && env.PACKAGING_PLATFORM == 'win' && env.COMPATIBILITY_MODE == 'normal' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: yarn pack-win-ee
- run: yarn add electron@22.3.27
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || env.COMPATIBILITY_MODE == 'legacy' }}
working-directory: ./
name: "Install Legacy Electron"
- name: "Download Yak Legacy Engine via wget(Windows)"
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || env.COMPATIBILITY_MODE == 'legacy' }}
id: download-windows-leagacy-engine
run: rm ./bins/yak_windows_amd64.zip && wget -O bins/yak_windows_amd64.exe https://yaklang.oss-accelerate.aliyuncs.com/yak/latest/yak_windows_legacy_amd64.exe && zip ./bins/yak_windows_amd64.zip ./bins/yak_windows_amd64.exe && rm ./bins/yak_windows_amd64.exe
- name: Build EE Yakit Legacy (MultiPlatform)
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || (env.PACKAGING_PLATFORM == 'mwl' && env.COMPATIBILITY_MODE == 'legacy') }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: yarn add -D dmg-license && yarn electron-publish-ee-legacy
- name: Build EE Yakit Legacy (MAC)
if: ${{ env.IS_TAG_RELEASE != 'tag/v' && env.PACKAGING_PLATFORM == 'mac' && env.COMPATIBILITY_MODE == 'legacy' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: yarn pack-mac-ee-legacy
- name: Build EE Yakit Legacy (LINUX)
if: ${{ env.IS_TAG_RELEASE != 'tag/v' && env.PACKAGING_PLATFORM == 'linux' && env.COMPATIBILITY_MODE == 'legacy' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: yarn pack-linux-ee-legacy
- name: Build EE Yakit Legacy (WIN)
if: ${{ env.IS_TAG_RELEASE != 'tag/v' && env.PACKAGING_PLATFORM == 'win' && env.COMPATIBILITY_MODE == 'legacy' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: yarn pack-win-ee-legacy
- name: View Published Content
run:
ls ./release
# CSPG-1.3.4-sp7-darwin-arm64.dmg
# CSPG-1.3.4-sp7-darwin-x64.dmg
# CSPG-1.3.4-sp7-linux-amd64.AppImage
# CSPG-1.3.4-sp7-linux-arm64.AppImage
# CSPG-1.3.4-sp7-windows-amd64.exe
# CSPG-1.3.4-sp7-darwin-legacy-arm64.dmg
# CSPG-1.3.4-sp7-darwin-legacy-x64.dmg
# CSPG-1.3.4-sp7-linux-legacy-amd64.AppImage
# CSPG-1.3.4-sp7-linux-legacy-arm64.AppImage
# CSPG-1.3.4-sp7-windows-legacy-amd64.exe
- name: Upload Yakit(EE) Artifacts Windows
uses: actions/upload-artifact@v4
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || ((env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'win') && env.COMPATIBILITY_MODE == 'normal') }}
with:
# CSPG-1.3.4-sp7-windows-amd64.exe
name: CSPG-${{ steps.package_version.outputs.value }}-windows-amd64.exe
path: ./release/CSPG-${{ steps.package_version.outputs.value }}-windows-amd64.exe
if-no-files-found: error
- name: Upload Yakit(EE) Artifacts Mac(m1)
uses: actions/upload-artifact@v4
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || ((env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'mac') && env.COMPATIBILITY_MODE == 'normal') }}
with:
# CSPG-1.3.4-sp7-darwin-arm64.dmg
name: CSPG-${{ steps.package_version.outputs.value }}-darwin-arm64.dmg
path: ./release/CSPG-${{ steps.package_version.outputs.value }}-darwin-arm64.dmg
if-no-files-found: error
- name: Upload Yakit(EE) Artifacts Mac(intel)
uses: actions/upload-artifact@v4
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || ((env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'mac') && env.COMPATIBILITY_MODE == 'normal') }}
with:
# CSPG-1.3.4-sp7-darwin-x64.dmg
name: CSPG-${{ steps.package_version.outputs.value }}-darwin-x64.dmg
path: ./release/CSPG-${{ steps.package_version.outputs.value }}-darwin-x64.dmg
if-no-files-found: error
- name: Upload Yakit(EE) Artifacts Linux(amd64)
uses: actions/upload-artifact@v4
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || ((env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'linux') && env.COMPATIBILITY_MODE == 'normal') }}
with:
# CSPG-1.3.4-sp7-linux-amd64.AppImage
name: CSPG-${{ steps.package_version.outputs.value }}-linux-amd64.AppImage
path: ./release/CSPG-${{ steps.package_version.outputs.value }}-linux-amd64.AppImage
if-no-files-found: error
- name: Upload Yakit(EE) Artifacts Linux(arm64)
uses: actions/upload-artifact@v4
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || ((env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'linux') && env.COMPATIBILITY_MODE == 'normal') }}
with:
# CSPG-1.3.4-sp7-linux-arm64.AppImage
name: CSPG-${{ steps.package_version.outputs.value }}-linux-arm64.AppImage
path: ./release/CSPG-${{ steps.package_version.outputs.value }}-linux-arm64.AppImage
if-no-files-found: error
- name: Upload Yakit(EE) Artifacts Legacy Windows
uses: actions/upload-artifact@v4
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || ((env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'win') && env.COMPATIBILITY_MODE == 'legacy') }}
with:
# CSPG-1.3.4-sp7-windows-legacy-amd64.exe
name: CSPG-${{ steps.package_version.outputs.value }}-windows-legacy-amd64.exe
path: ./release/CSPG-${{ steps.package_version.outputs.value }}-windows-legacy-amd64.exe
if-no-files-found: error
- name: Upload Yakit(EE) Artifacts Legacy Mac(m1)
uses: actions/upload-artifact@v4
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || ((env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'mac') && env.COMPATIBILITY_MODE == 'legacy') }}
with:
# CSPG-1.3.4-sp7-darwin-legacy-arm64.dmg
name: CSPG-${{ steps.package_version.outputs.value }}-darwin-legacy-arm64.dmg
path: ./release/CSPG-${{ steps.package_version.outputs.value }}-darwin-legacy-arm64.dmg
if-no-files-found: error
- name: Upload Yakit(EE) Artifacts Legacy Mac(intel)
uses: actions/upload-artifact@v4
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || ((env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'mac') && env.COMPATIBILITY_MODE == 'legacy') }}
with:
# CSPG-1.3.4-sp7-darwin-legacy-x64.dmg
name: CSPG-${{ steps.package_version.outputs.value }}-darwin-legacy-x64.dmg
path: ./release/CSPG-${{ steps.package_version.outputs.value }}-darwin-legacy-x64.dmg
if-no-files-found: error
- name: Upload Yakit(EE) Artifacts Legacy Linux(amd64)
uses: actions/upload-artifact@v4
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || ((env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'linux') && env.COMPATIBILITY_MODE == 'legacy') }}
with:
# CSPG-1.3.4-sp7-linux-legacy-amd64.AppImage
name: CSPG-${{ steps.package_version.outputs.value }}-linux-legacy-amd64.AppImage
path: ./release/CSPG-${{ steps.package_version.outputs.value }}-linux-legacy-amd64.AppImage
if-no-files-found: error
- name: Upload Yakit(EE) Artifacts Legacy Linux(arm64)
uses: actions/upload-artifact@v4
if: ${{ env.IS_TAG_RELEASE == 'tag/v' || ((env.PACKAGING_PLATFORM == 'mwl' || env.PACKAGING_PLATFORM == 'linux') && env.COMPATIBILITY_MODE == 'legacy') }}
with:
# CSPG-1.3.4-sp7-linux-legacy-arm64.AppImage
name: CSPG-${{ steps.package_version.outputs.value }}-linux-legacy-arm64.AppImage
path: ./release/CSPG-${{ steps.package_version.outputs.value }}-linux-legacy-arm64.AppImage
if-no-files-found: error
publish_yakit_ee_to_oss:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs:
- build_yakit
runs-on: ubuntu-latest
steps:
- name: Fetch Yakit EE Tag
uses: mad9000/actions-find-and-replace-string@5
id: fetch_tag_release
with:
source: ${{ github.ref }}
find: "refs/tags/v"
replace: ""
- name: Generate Yakit EE Version
uses: mad9000/actions-find-and-replace-string@5
id: generate_version
with:
source: ${{ steps.fetch_tag_release.outputs.value }}
find: "-ee"
replace: ""
- name: Download EE Yakit And Legacy Yakit
uses: actions/download-artifact@v4
with:
merge-multiple: true
- run: ls
name: Ls Published Artifacts...
- name: Upload Yakit EE To OSS
uses: tvrcgo/upload-to-oss@master
with:
key-id: ${{ secrets.OSS_KEY_ID }}
key-secret: ${{ secrets.OSS_KEY_SECRET }}
region: oss-accelerate
bucket: yaklang
assets: |
*:/vip/${{ steps.generate_version.outputs.value }}/
- name: Update OSS latest file
run: echo ${{ steps.generate_version.outputs.value }} > ./yakit-version.txt
- name: Upload EE Yakit Version to oss
uses: tvrcgo/upload-to-oss@master
with:
key-id: ${{ secrets.OSS_KEY_ID }}
key-secret: ${{ secrets.OSS_KEY_SECRET }}
region: oss-accelerate
bucket: yaklang
assets: |
./yakit-version.txt:/vip/latest/yakit-version.txt