-
Notifications
You must be signed in to change notification settings - Fork 729
339 lines (310 loc) · 17.1 KB
/
multi-platform-build.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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
name: Multi-Platform Build Develop
on:
workflow_dispatch:
inputs:
platform:
description: "Choose a platform"
required: true
type: choice
options:
- windows
- darwin
- linux
- mwl
legacy:
description: "Legacy system version"
required: false
type: boolean
default: false
version:
description: "Select version type"
required: true
type: choice
default: ce
options:
- ce
- ee
- se
- irify
- irifyee
engine:
description: "Is there a built-in engine"
required: false
type: boolean
default: false
engineVersion:
description: "Specify engine version(need check built-in engine"
required: false
type: string
noBuiltInYakVersion:
description: "No built-in yak version number"
required: false
type: boolean
default: false
devTool:
description: "Display developer tools"
required: false
type: boolean
default: false
jobs:
build_yakit:
runs-on: macos-13
env:
CI: ""
NODE_OPTIONS: --max_old_space_size=4096
steps:
- name: Display incoming configuration parameters
run: echo ${{ inputs.platform }} ${{ inputs.legacy }} ${{ inputs.version }} ${{ inputs.engine }} ${{ inputs.engineVersion }} ${{ inputs.devTool }}
- 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_name }}
- run: cp buildutil/zip /usr/local/bin/zip
- run: chmod +x /usr/local/bin/zip
- run: zip -h
- name: "Download yakit-chrome-extension"
run: |
extensionVersion=$(curl -fsL "http://yaklang.oss-accelerate.aliyuncs.com/chrome-extension/latest-version.txt") || {
echo "Failed to download!" >&2
exit 1
}
wget -O bins/scripts/google-chrome-plugin.zip https://oss-qn.yaklang.com/chrome-extension/yakit-chrome-extension-v${extensionVersion}.zip
shell: bash
- name: "Fetch Latest EngineVersion"
if: ${{ inputs.engine && !inputs.engineVersion }}
run: wget -O bins/engine-version.txt https://oss-qn.yaklang.com/yak/latest/version.txt
- name: "Fetch Specify EngineVersion"
if: ${{ inputs.engine && inputs.engineVersion }}
run: |
mkdir -p bins
echo "${{ inputs.engineVersion }}" > bins/engine-version.txt
- if: ${{ inputs.engine }}
run: |
cat bins/engine-version.txt
YAK_VERSION=$(cat bins/engine-version.txt | tr -d '\n')
echo "ENGINE_VERSION=$YAK_VERSION" >> $GITHUB_ENV
- if: ${{ inputs.engine && inputs.noBuiltInYakVersion }}
run: rm ./bins/engine-version.txt
- name: "Download Yak Engine via wget(MacOS)"
if: ${{ inputs.engine && contains(fromJSON('["darwin","mwl"]'), inputs.platform) }}
id: download-darwin-engine
run: wget -O bins/yak_darwin_amd64 https://oss-qn.yaklang.com/yak/${{ inputs.engineVersion || env.ENGINE_VERSION }}/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: ${{ inputs.engine && contains(fromJSON('["darwin","mwl"]'), inputs.platform) }}
id: download-darwin-engine-arm64
run: wget -O bins/yak_darwin_arm64 https://oss-qn.yaklang.com/yak/${{ inputs.engineVersion || env.ENGINE_VERSION }}/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: ${{ inputs.engine && contains(fromJSON('["linux","mwl"]'), inputs.platform) }}
id: download-linux-engine
run: wget -O bins/yak_linux_amd64 https://oss-qn.yaklang.com/yak/${{ inputs.engineVersion || env.ENGINE_VERSION }}/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: ${{ inputs.engine && contains(fromJSON('["linux","mwl"]'), inputs.platform) }}
id: download-linux-engine-arm64
run: wget -O bins/yak_linux_arm64 https://oss-qn.yaklang.com/yak/${{ inputs.engineVersion || env.ENGINE_VERSION }}/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: ${{ inputs.engine && !inputs.legacy && contains(fromJSON('["windows","mwl"]'), inputs.platform) }}
id: download-windows-engine
run: wget -O bins/yak_windows_amd64.exe https://oss-qn.yaklang.com/yak/${{ inputs.engineVersion || env.ENGINE_VERSION }}/yak_windows_amd64.exe && zip ./bins/yak_windows_amd64.zip ./bins/yak_windows_amd64.exe && rm ./bins/yak_windows_amd64.exe
- name: "Download Yak Legacy Engine via wget(Windows)"
if: ${{ inputs.engine && inputs.legacy && contains(fromJSON('["windows","mwl"]'), inputs.platform) }}
id: download-windows-leagacy-engine
run: wget -O bins/yak_windows_amd64.exe https://oss-qn.yaklang.com/yak/${{ inputs.engineVersion || env.ENGINE_VERSION }}/yak_windows_legacy_amd64.exe && zip ./bins/yak_windows_amd64.zip ./bins/yak_windows_amd64.exe && rm ./bins/yak_windows_amd64.exe
- name: Extract Package.json Version
id: extract_version
uses: Saionaro/[email protected]
- name: Crop 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: Crop 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 "SOFTWARE_VERSION=${{ steps.package_version.outputs.value }}" >> $GITHUB_ENV
- name: "Install Dependencies"
run: yarn install && yarn install-render
working-directory: ./
- name: "Install Legacy Electron"
run: yarn remove electron && yarn add [email protected] --dev
if: ${{ inputs.legacy }}
working-directory: ./
- name: "Build CE Render"
if: ${{ inputs.version == 'ce' }}
working-directory: ./
run: yarn build${{ inputs.devTool && '-test' || '' }}-render
- name: "Build EE Render"
if: ${{ inputs.version == 'ee' }}
working-directory: ./
run: yarn build-render${{ inputs.devTool && '-test' || '' }}-enterprise
- name: "Build SE Render"
if: ${{ inputs.version == 'se' }}
working-directory: ./
run: yarn build-render${{ inputs.devTool && '-test' || '' }}-simple-enterprise
- name: "Build IRify Render"
if: ${{ inputs.version == 'irify' }}
working-directory: ./
run: yarn build-render${{ inputs.devTool && '-test' || '' }}-irify
- name: "Build IRifyEE Render"
if: ${{ inputs.version == 'irifyee' }}
working-directory: ./
run: yarn build-render${{ inputs.devTool && '-test' || '' }}-irify-enterprise
- name: Build Yakit (MultiPlatform)
if: ${{ inputs.platform == 'mwl' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: |
yarn add -D dmg-license
if [ "${{ inputs.version }}" = "ce" ]; then
yarn electron-publish${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "ee" ]; then
yarn electron-publish-ee${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "se" ]; then
yarn electron-publish-se${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "irify" ]; then
yarn electron-publish-irify${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "irifyee" ]; then
yarn electron-publish-irify-ee${{ inputs.legacy && '-legacy' || '' }}
else
echo "未知的输入值: ${{ inputs.version }}" >&2
exit 1
fi
- name: Build Yakit (MAC)
if: ${{ inputs.platform == 'darwin' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: |
if [ "${{ inputs.version }}" = "ce" ]; then
yarn pack-mac${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "ee" ]; then
yarn pack-mac-ee${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "se" ]; then
yarn pack-mac-se${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "irify" ]; then
yarn pack-mac-irify${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "irifyee" ]; then
yarn pack-mac-irify-ee${{ inputs.legacy && '-legacy' || '' }}
else
echo "未知的输入值: ${{ inputs.version }}" >&2
exit 1
fi
- name: Build Yakit (LINUX)
if: ${{ inputs.platform == 'linux' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: |
if [ "${{ inputs.version }}" = "ce" ]; then
yarn pack-linux${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "ee" ]; then
yarn pack-linux-ee${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "se" ]; then
yarn pack-linux-se${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "irify" ]; then
yarn pack-linux-irify${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "irifyee" ]; then
yarn pack-linux-irify-ee${{ inputs.legacy && '-legacy' || '' }}
else
echo "未知的输入值: ${{ inputs.version }}" >&2
exit 1
fi
- name: Build Yakit (WIN)
if: ${{ inputs.platform == 'windows' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: ./
run: |
if [ "${{ inputs.version }}" = "ce" ]; then
yarn pack-win${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "ee" ]; then
yarn pack-win-ee${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "se" ]; then
yarn pack-win-se${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "irify" ]; then
yarn pack-win-irify${{ inputs.legacy && '-legacy' || '' }}
elif [ "${{ inputs.version }}" = "irifyee" ]; then
yarn pack-win-irify-ee${{ inputs.legacy && '-legacy' || '' }}
else
echo "未知的输入值: ${{ inputs.version }}" >&2
exit 1
fi
- name: View Published Content
run:
ls ./release
# EnpriTraceAgent -1.3.4-sp6-darwin-arm64(.dmg|.exe|.AppImage)
# EnpriTrace -1.3.4-sp6-darwin-arm64(.dmg|.exe|.AppImage)
# Yakit -1.3.4-sp6-darwin-arm64(.dmg|.exe|.AppImage)
# IRify -1.3.4-sp6-darwin-arm64(.dmg|.exe|.AppImage)
# IRifyEnpriTrace -1.3.4-sp6-darwin-arm64(.dmg|.exe|.AppImage)
- name: Generate software prefix name
run: |
if [ "${{ inputs.version }}" = "ce" ]; then
echo "ENV_Software_Name=Yakit" >> $GITHUB_ENV
elif [ "${{ inputs.version }}" = "ee" ]; then
echo "ENV_Software_Name=EnpriTrace" >> $GITHUB_ENV
elif [ "${{ inputs.version }}" = "se" ]; then
echo "ENV_Software_Name=EnpriTraceAgent" >> $GITHUB_ENV
elif [ "${{ inputs.version }}" = "irify" ]; then
echo "ENV_Software_Name=IRify" >> $GITHUB_ENV
elif [ "${{ inputs.version }}" = "irifyee" ]; then
echo "ENV_Software_Name=IRifyEnpriTrace" >> $GITHUB_ENV
else
echo "No software version obtained" >&2
exit 1
fi
- name: Show ENV_Software_Name
run: echo "ENV_Software_Name: $ENV_Software_Name"
- name: Upload Yakit(CE) Artifacts Windows
if: ${{ contains(fromJSON('["windows","mwl"]'), inputs.platform) }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ENV_Software_Name }}-${{ env.SOFTWARE_VERSION }}-windows${{ inputs.legacy && '-legacy' || '' }}-amd64.exe
path: ./release/${{env.ENV_Software_Name}}-${{env.SOFTWARE_VERSION}}-windows${{ inputs.legacy && '-legacy' || '' }}-amd64.exe
if-no-files-found: error
retention-days: 7
- name: Upload Yakit(CE) Artifacts Mac Amd
if: ${{ contains(fromJSON('["darwin","mwl"]'), inputs.platform) }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ENV_Software_Name }}-${{ env.SOFTWARE_VERSION }}-darwin${{ inputs.legacy && '-legacy' || '' }}-x64.dmg
path: ./release/${{env.ENV_Software_Name}}-${{env.SOFTWARE_VERSION}}-darwin${{ inputs.legacy && '-legacy' || '' }}-x64.dmg
if-no-files-found: error
retention-days: 7
- name: Upload Yakit(CE) Artifacts Mac Arm
if: ${{ contains(fromJSON('["darwin","mwl"]'), inputs.platform) }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ENV_Software_Name }}-${{ env.SOFTWARE_VERSION }}-darwin${{ inputs.legacy && '-legacy' || '' }}-arm64.dmg
path: ./release/${{env.ENV_Software_Name}}-${{env.SOFTWARE_VERSION}}-darwin${{ inputs.legacy && '-legacy' || '' }}-arm64.dmg
if-no-files-found: error
retention-days: 7
- name: Upload Yakit(CE) Artifacts Linux Amd
if: ${{ contains(fromJSON('["linux","mwl"]'), inputs.platform) }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ENV_Software_Name }}-${{ env.SOFTWARE_VERSION }}-linux${{ inputs.legacy && '-legacy' || '' }}-amd64.AppImage
path: ./release/${{env.ENV_Software_Name}}-${{env.SOFTWARE_VERSION}}-linux${{ inputs.legacy && '-legacy' || '' }}-amd64.AppImage
if-no-files-found: error
retention-days: 7
- name: Upload Yakit(CE) Artifacts Linux Arm
if: ${{ contains(fromJSON('["linux","mwl"]'), inputs.platform) }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ENV_Software_Name }}-${{ env.SOFTWARE_VERSION }}-linux${{ inputs.legacy && '-legacy' || '' }}-arm64.AppImage
path: ./release/${{env.ENV_Software_Name}}-${{env.SOFTWARE_VERSION}}-linux${{ inputs.legacy && '-legacy' || '' }}-arm64.AppImage
if-no-files-found: error
retention-days: 7