-
Notifications
You must be signed in to change notification settings - Fork 0
423 lines (356 loc) · 24.2 KB
/
cd.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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
on:
push:
branches:
- cd-test
pull_request:
branches:
- cd-test
jobs:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-13]
runs-on: ${{ matrix.os }}
outputs:
# region ------------Windows start
# ----------------------------------------------------------------------------------------X64
INSTALLER_NAME_X64_SETUP_EXE: ${{ env.INSTALLER_NAME_X64_SETUP_EXE }}
INSTALLER_NAME_X64_ZIP: ${{ env.INSTALLER_NAME_X64_ZIP }}
SHA256_X64_SETUP_EXE: ${{ env.SHA256_X64_SETUP_EXE }}
MD5_X64_SETUP_EXE: ${{ env.MD5_X64_SETUP_EXE }}
# ----------------------------------------------------------------------------------------arm64
# endregion
# -------------------Windows end
# region ------------Linux start
# ----------------------------------------------------------------------------------------X64
# ----------------------------------------------------------------------------------------X64_TARGZ
INSTALLER_NAME_X64_TARGZ: ${{ env.INSTALLER_NAME_X64_TARGZ }}
SHA256_X64_TARGZ: ${{ env.SHA256_X64_TARGZ }}
MD5_X64_TARGZ: ${{ env.MD5_X64_TARGZ }}
# ----------------------------------------------------------------------------------------X64_APPIMAGE
INSTALLER_NAME_X64_APPIMAGE: ${{ env.INSTALLER_NAME_X64_APPIMAGE }}
SHA256_X64_APPIMAGE: ${{ env.SHA256_X64_APPIMAGE }}
MD5_X64_APPIMAGE: ${{ env.MD5_X64_APPIMAGE }}
# ----------------------------------------------------------------------------------------X64_DEB
INSTALLER_NAME_X64_DEB: ${{ env.INSTALLER_NAME_X64_DEB }}
SHA256_X64_DEB: ${{ env.SHA256_X64_DEB }}
MD5_X64_DEB: ${{ env.MD5_X64_DEB }}
# ----------------------------------------------------------------------------------------arm64
# endregion
# -------------------Linux end
# region ------------MacOS start
# ----------------------------------------------------------------------------------------X64
# ----------------------------------------------------------------------------------------X64_dmg
INSTALLER_NAME_X64_DMG: ${{ env.INSTALLER_NAME_X64_DMG }}
SHA256_X64_DMG: ${{ env.SHA256_X64_DMG }}
MD5_X64_DMG: ${{ env.MD5_X64_DMG }}
# ----------------------------------------------------------------------------------------arm64
# ----------------------------------------------------------------------------------------arm64_dmg
INSTALLER_NAME_ARM64_DMG: ${{ env.INSTALLER_NAME_ARM64_DMG }}
SHA256_ARM64_DMG: ${{ env.SHA256_ARM64_DMG }}
MD5_ARM64_DMG: ${{ env.MD5_ARM64_DMG }}
# endregion
# -------------------MacOS end
steps:
- name: Checkout code
uses: actions/checkout@v4 # 将仓库代码复制到虚拟机文件系统中
- name: Set up Go
uses: actions/setup-go@v5 # 安装go依赖
with:
go-version: 1.22.0 # 指定go依赖版本
- name: Install Node.js
uses: actions/setup-node@v4 # 安装nodejs
with:
node-version: "16" # 指定nodejs 版本
- name: Install Quasar CLI
run: npm install -g @quasar/cli # 安装quasar/cli
- name: Install frontend dependencies
working-directory: frontend # 以项目根目录为起点,指定对应目录
run: npm install # 安装前端依赖
################################################# Win start ######################################################
# region
- name: Build Application (Windows x64)
if: matrix.os == 'windows-latest'
shell: bash # 我不喜欢powershell(即使是在windows下) # 这个指定, 应该会让我们使用git-bash。
run: | # 指定此run为多个命令依次执行
cd sdk
make win
- name: Find the generated installer (Windows x64)
if: matrix.os == 'windows-latest'
working-directory: frontend/dist/electron/Packaged
shell: bash # 由于我们下方要使用的find命令, powershell中没有(更重要的是, 我不喜欢powershell) # 这个指定, 应该会让我们使用git-bash。
run: |
# 由于find -name 'KeyTone-Setup-*-win.exe'得到的结果为./KeyTone-Setup-*-win.exe , 而我们不需要./ , 因此使用basename提取文件名
# 由于大部分人的计算机是x64架构的(现在x86的纯32位系统几乎没人用了, 因此我的应用只支持64位的机器), 所以默认不显示架构。(我们通过正则表达式来除掉这部分)(主要显示了3中形式太乱, 如amd64、x64、x86_64)
# * 这部分正则的原理是, 替换: 将 `从win末尾的任意字符开头至遇到第一个.后的所有内容` 使用`win.` 来替换。
# ----------------------------------------------------------------------------------------INSTALLER_NAME_X64_SETUP_EXE
INSTALLER_NAME_X64_SETUP_EXE=$(basename $(find -name 'KeyTone-*-win*exe'))
# ----------为避免出现amd64、x86_64、x64等多种x64的cpu架构表示方式, 我仅按x64为默认名来显示此类cpu架构名---start
# * 我们仅按x64为默认名来显示的话, 就存在其结果本身就是x64这个名称的情况, 那此时仍通过 mv 重命名就会发生报错了。
# * 因为, 在进行mv时, 遇到移动前后名称相同的情况, 是会报错的。
# * 所以, 我们为了不报错, 我们尝试通过`-f`来强制重命名来解决。(失败)<因为-f解决覆盖问题, 但无法处理此情况>
# * 最终, 借助shell中的判断语句来解决
if [ "$INSTALLER_NAME_X64_SETUP_EXE" != "$(echo $INSTALLER_NAME_X64_SETUP_EXE | sed 's/win[^.]*\./win-x64./')" ]; then
mv -f $INSTALLER_NAME_X64_SETUP_EXE $(echo $INSTALLER_NAME_X64_SETUP_EXE | sed 's/win[^.]*\./win-x64./')
INSTALLER_NAME_X64_SETUP_EXE=$(echo $INSTALLER_NAME_X64_SETUP_EXE | sed 's/win[^.]*\./win-x64./')
fi
# ------------为避免出现amd64、x86_64、x64等多种x64的cpu架构表示方式, 我仅按x64为默认名来显示此类cpu架构名---end
echo "INSTALLER_NAME_X64_SETUP_EXE=$INSTALLER_NAME_X64_SETUP_EXE" >> $GITHUB_ENV
# ---------------------------------------------------------------------------------------------------ZIP start
INSTALLER_NAME_NO_EXE=$(echo $INSTALLER_NAME_X64_SETUP_EXE | sed 's/\.exe$//')
# 定义好ZIP文件的文件名变量 `INSTALLER_NAME_X64_ZIP`
INSTALLER_NAME_X64_ZIP=$(echo ${INSTALLER_NAME_NO_EXE}_exe.zip)
# 上方定义必须有, 下方的语法仅是设置了 `>> $GITHUB_ENV` 而已, 并没有在当前步骤中定义变量。
# * 简单的说就是, 若缺失上方定义, 则本小节最后一步就会因找不到变量而执行失败。
echo "INSTALLER_NAME_X64_ZIP=$INSTALLER_NAME_X64_ZIP" >> $GITHUB_ENV
choco install zip -y
zip -j -9 ${INSTALLER_NAME_X64_ZIP} ${INSTALLER_NAME_X64_SETUP_EXE}
# -----------------------------------------------------------------------------------------------------ZIP end
- name: Calculate File Hashes (Windows x64)
if: matrix.os == 'windows-latest'
shell: bash
run: |
SHA256_X64_SETUP_EXE=$(sha256sum frontend/dist/electron/Packaged/${{ env.INSTALLER_NAME_X64_SETUP_EXE }} | awk '{print $1}')
MD5_X64_SETUP_EXE=$(md5sum frontend/dist/electron/Packaged/${{ env.INSTALLER_NAME_X64_SETUP_EXE }} | awk '{print $1}')
echo "SHA256_X64_SETUP_EXE=$SHA256_X64_SETUP_EXE" >> $GITHUB_ENV
echo "MD5_X64_SETUP_EXE=$MD5_X64_SETUP_EXE" >> $GITHUB_ENV
# ------------------------------------------------------/////////////////////
# - name: Build Application (Windows arm64)
# - name: Find the generated installer (Windows arm64)
# - name: Calculate File Hashes (Windows arm64)
# endregion
################################################# Win end ######################################################
############################################### Linux start ######################################################
# region
- name: Build Application (Linux x64)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: | # 指定此run为多个命令依次执行
cd sdk
sudo apt-get update
sudo apt install gcc libc6-dev
sudo apt install libx11-dev xorg-dev libxtst-dev
sudo apt install xsel xclip
sudo apt install libpng++-dev
sudo apt install xcb libxcb-xkb-dev x11-xkb-utils libx11-xcb-dev libxkbcommon-x11-dev libxkbcommon-dev
sudo apt install libasound2-dev
make linux
- name: Find the generated installer (Linux x64)
if: matrix.os == 'ubuntu-latest'
working-directory: frontend/dist/electron/Packaged
shell: bash
run: |
# ----------------------------------------------------------------------------------------INSTALLER_NAME_X64_TARGZ
INSTALLER_NAME_X64_TARGZ=$(basename $(find -name 'KeyTone-*-linux*tar.gz'))
if [ "$INSTALLER_NAME_X64_TARGZ" != "$(echo $INSTALLER_NAME_X64_TARGZ | sed 's/linux[^.]*\./linux-x64./')" ]; then
mv -f $INSTALLER_NAME_X64_TARGZ $(echo $INSTALLER_NAME_X64_TARGZ | sed 's/linux[^.]*\./linux-x64./')
INSTALLER_NAME_X64_TARGZ=$(echo $INSTALLER_NAME_X64_TARGZ | sed 's/linux[^.]*\./linux-x64./')
fi
echo "INSTALLER_NAME_X64_TARGZ=$INSTALLER_NAME_X64_TARGZ" >> $GITHUB_ENV
# ----------------------------------------------------------------------------------------INSTALLER_NAME_X64_APPIMAGE
INSTALLER_NAME_X64_APPIMAGE=$(basename $(find -name 'KeyTone-*-linux*AppImage'))
if [ "$INSTALLER_NAME_X64_APPIMAGE" != "$(echo $INSTALLER_NAME_X64_APPIMAGE | sed 's/linux[^.]*\./linux-x64./')" ]; then
mv -f $INSTALLER_NAME_X64_APPIMAGE $(echo $INSTALLER_NAME_X64_APPIMAGE | sed 's/linux[^.]*\./linux-x64./')
INSTALLER_NAME_X64_APPIMAGE=$(echo $INSTALLER_NAME_X64_APPIMAGE | sed 's/linux[^.]*\./linux-x64./')
fi
echo "INSTALLER_NAME_X64_APPIMAGE=$INSTALLER_NAME_X64_APPIMAGE" >> $GITHUB_ENV
# ----------------------------------------------------------------------------------------INSTALLER_NAME_X64_DEB
INSTALLER_NAME_X64_DEB=$(basename $(find -name 'KeyTone-*-linux*deb'))
if [ "$INSTALLER_NAME_X64_DEB" != "$(echo $INSTALLER_NAME_X64_DEB | sed 's/linux[^.]*\./linux-x64./')" ]; then
mv -f $INSTALLER_NAME_X64_DEB $(echo $INSTALLER_NAME_X64_DEB | sed 's/linux[^.]*\./linux-x64./')
INSTALLER_NAME_X64_DEB=$(echo $INSTALLER_NAME_X64_DEB | sed 's/linux[^.]*\./linux-x64./')
fi
echo "INSTALLER_NAME_X64_DEB=$INSTALLER_NAME_X64_DEB" >> $GITHUB_ENV
- name: Calculate File Hashes (Linux x64)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
# ----------------------------------------------------------------------------------------X64_TARGZ
SHA256_X64_TARGZ=$(sha256sum frontend/dist/electron/Packaged/${{ env.INSTALLER_NAME_X64_TARGZ }} | awk '{print $1}')
MD5_X64_TARGZ=$(md5sum frontend/dist/electron/Packaged/${{ env.INSTALLER_NAME_X64_TARGZ }} | awk '{print $1}')
echo "SHA256_X64_TARGZ=$SHA256_X64_TARGZ" >> $GITHUB_ENV
echo "MD5_X64_TARGZ=$MD5_X64_TARGZ" >> $GITHUB_ENV
# ----------------------------------------------------------------------------------------X64_APPIMAGE
SHA256_X64_APPIMAGE=$(sha256sum frontend/dist/electron/Packaged/${{ env.INSTALLER_NAME_X64_APPIMAGE }} | awk '{print $1}')
MD5_X64_APPIMAGE=$(md5sum frontend/dist/electron/Packaged/${{ env.INSTALLER_NAME_X64_APPIMAGE }} | awk '{print $1}')
echo "SHA256_X64_APPIMAGE=$SHA256_X64_APPIMAGE" >> $GITHUB_ENV
echo "MD5_X64_APPIMAGE=$MD5_X64_APPIMAGE" >> $GITHUB_ENV
# ----------------------------------------------------------------------------------------X64_DEB
SHA256_X64_DEB=$(sha256sum frontend/dist/electron/Packaged/${{ env.INSTALLER_NAME_X64_DEB }} | awk '{print $1}')
MD5_X64_DEB=$(md5sum frontend/dist/electron/Packaged/${{ env.INSTALLER_NAME_X64_DEB }} | awk '{print $1}')
echo "SHA256_X64_DEB=$SHA256_X64_DEB" >> $GITHUB_ENV
echo "MD5_X64_DEB=$MD5_X64_DEB" >> $GITHUB_ENV
# endregion
############################################### Linux end ######################################################
############################################### MacOS start ######################################################
# region
- name: Build Application (MacOS x64)
if: matrix.os == 'macos-13'
shell: bash
run: | # 指定此run为多个命令依次执行
cd sdk
make mac
- name: Find the generated installer (MacOS x64)
if: matrix.os == 'macos-13'
working-directory: frontend/dist/electron/Packaged
shell: bash
run: |
# ----------------------------------------------------------------------------------------INSTALLER_NAME_X64_DMG
INSTALLER_NAME_X64_DMG=$(basename $(find . -name 'KeyTone-*-mac*dmg'))
if [ "$INSTALLER_NAME_X64_DMG" != "$(echo $INSTALLER_NAME_X64_DMG | sed 's/mac[^.]*\./mac-x64./')" ]; then
mv -f $INSTALLER_NAME_X64_DMG $(echo $INSTALLER_NAME_X64_DMG | sed 's/mac[^.]*\./mac-x64./')
INSTALLER_NAME_X64_DMG=$(echo $INSTALLER_NAME_X64_DMG | sed 's/mac[^.]*\./mac-x64./')
fi
echo "INSTALLER_NAME_X64_DMG=$INSTALLER_NAME_X64_DMG" >> $GITHUB_ENV
- name: Calculate File Hashes (MacOS x64)
if: matrix.os == 'macos-13'
shell: bash
run: |
SHA256_X64_DMG=$(shasum -a 256 frontend/dist/electron/Packaged/${{ env.INSTALLER_NAME_X64_DMG }} | awk '{print $1}')
MD5_X64_DMG=$(md5 frontend/dist/electron/Packaged/${{ env.INSTALLER_NAME_X64_DMG }} | awk '{print $1}')
echo "SHA256_X64_DMG=$SHA256_X64_DMG" >> $GITHUB_ENV
echo "MD5_X64_DMG=$MD5_X64_DMG" >> $GITHUB_ENV
# endregion
############################################### MacOS end ######################################################
- name: Upload Build Artifact (ALL)
# TIPS: Artifact 中, 通过手动点击, 下载的打包结果的名称(无论名称如何设置, 都会给你加载.zip后缀的, 这是其预期的行为)
# > 虽然单看大小并没有被压缩, 但确实是套了一层文件夹后的压缩格式, 而不是简单的仅更改了后缀名。可通过hash值验证:
# > * 此下载包的hash结果不符合校验值。
# > * 不进行解压, 仅通过手动删除掉.zip后缀的hash校验结果, 与改名前的原始下载包相同, 即此hash结果也不符合校验值。
# > * 对下载包进行解压, 解压结果中获得一个文件夹, 进入文件下后可看到的exe安装包, 对此exe安装包进行hash, 其结果符合hash校验值。
#
# TIPS: 但是通过actions/download-artifact@v3进行下载时, 不会出现像手动下载时那样的.zip后缀(因此我们无需在release作业的下载完成够的步骤中, 进行解压缩)。仍是可以直接通过hash值验证:
# * 在release中没有进行解压缩步骤的情况下, 下载结果直接是 .exe 的可执行安装程序, 对此安装包进行hash, 其结果符合hash校验值。
uses: actions/upload-artifact@v3
with:
name: INSTALLER_NAME_ALL
path: |
frontend/dist/electron/Packaged/${{ env.INSTALLER_NAME_X64_SETUP_EXE }}
frontend/dist/electron/Packaged/${{ env.INSTALLER_NAME_X64_ZIP }}
release:
runs-on: ubuntu-latest
needs: build # 我们release工作job的执行, 需要等待build的工作job执行结束。
steps:
- name: Checkout code
uses: actions/checkout@v4 # 将仓库代码复制到虚拟机文件系统中
- name: Download Build Artifact (ALL)
uses: actions/download-artifact@v3
with:
name: INSTALLER_NAME_ALL
- name: Create GitHub Release
id: create_release # id 项的作用是为这个步骤分配一个唯一的标识符。 使得你可以在后续的步骤中引用这个步骤的输出或状态(以step开头)。这样可以使工作流更加清晰和易于维护。
uses: actions/create-release@v1 # 安装用户自动创建release的脚本
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
with:
tag_name: ${{ github.ref }} # 选择此release的tag名称<准确来讲这是触发工作流的分支或标签的完整引用--即带前缀的`refs/heads/ 或 refs/tags/ 前缀`>(可以尝试手动创建一个release, 其界面上是有一个让你选择tag的选项框的)
release_name: Release ${{ github.ref_name }} # 这个是当前release的名称<这个并非像上面一样的完整引用--即不包括`refs/heads/ 或 refs/tags/ 前缀`>。(理论上github.ref_name的值: 如果当前actions是被push/tag触发的, 则会选择tag名; 若仅是push触发, 则会选择分支名)
draft: true # 此项为true, 表示发布的是仅自己可见的草稿(我们可以手动编辑检查后在手动发布)
prerelease: false # 此项若为true, 则会将release打上预发布标志
body: |
### Overview
### Security
##### The SHA256 hash sum
`${{ needs.build.outputs.INSTALLER_NAME_X64_SETUP_EXE }}` is:
* `${{ needs.build.outputs.SHA256_X64_SETUP_EXE }}`
`${{ needs.build.outputs.INSTALLER_NAME_X64_TARGZ }}` is:
* `${{ needs.build.outputs.SHA256_X64_TARGZ }}`
`${{ needs.build.outputs.INSTALLER_NAME_X64_APPIMAGE }}` is:
* `${{ needs.build.outputs.SHA256_X64_APPIMAGE }}`
`${{ needs.build.outputs.INSTALLER_NAME_X64_DEB }}` is:
* `${{ needs.build.outputs.SHA256_X64_DEB }}`
`${{ needs.build.outputs.INSTALLER_NAME_X64_DMG }}` is:
* `${{ needs.build.outputs.SHA256_X64_DMG }}`
##### The MD5 hash sum
`${{ needs.build.outputs.INSTALLER_NAME_X64_SETUP_EXE }}` is:
* `${{ needs.build.outputs.MD5_X64_SETUP_EXE }}`
`${{ needs.build.outputs.INSTALLER_NAME_X64_TARGZ }}` is:
* `${{ needs.build.outputs.MD5_X64_TARGZ }}`
`${{ needs.build.outputs.INSTALLER_NAME_X64_APPIMAGE }}` is:
* `${{ needs.build.outputs.MD5_X64_APPIMAGE }}`
`${{ needs.build.outputs.INSTALLER_NAME_X64_DEB }}` is:
* `${{ needs.build.outputs.MD5_X64_DEB }}`
`${{ needs.build.outputs.INSTALLER_NAME_X64_DMG }}` is:
* `${{ needs.build.outputs.MD5_X64_DMG }}`
### Changelogs
############################################ Upload Build Artifact to Release ########################### start
# region
# region ------------Windows start
- name: Upload Build Artifact to Release (Windows x64) (SETUP_EXE)
uses: actions/upload-release-asset@v1 # 安装用于上传最终打包结果到本次release的脚本
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # 这里就通过之前步骤的唯一id, 进行了进一步的操作(以将构建后的结果, 上传到此步骤的可供用户下载的地方)
asset_path: ./${{ needs.build.outputs.INSTALLER_NAME_X64_SETUP_EXE }}
asset_name: ${{ needs.build.outputs.INSTALLER_NAME_X64_SETUP_EXE }}
asset_content_type: application/octet-stream # asset_content_type 的作用是指定上传文件的 MIME 类型。在这个例子中,它被设置为 application/octet-stream,这是一种通用的二进制文件类型。这样做的目的是告诉 GitHub 这个文件的类型,以便在下载时正确处理它。
- name: Upload Build Artifact ZIP to Release (Windows x64)
uses: actions/upload-release-asset@v1 # 安装用于上传最终打包结果到本次release的脚本
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # 这里就通过之前步骤的唯一id, 进行了进一步的操作(以将构建后的结果, 上传到此步骤的可供用户下载的地方)
asset_path: ./${{ needs.build.outputs.INSTALLER_NAME_X64_ZIP }}
asset_name: ${{ needs.build.outputs.INSTALLER_NAME_X64_ZIP }}
asset_content_type: application/zip # asset_content_type 的作用是指定上传文件的 MIME 类型。在这个例子中,它被设置为 application/zip,这是一种通用的压缩文件类型。这样做的目的是告诉 GitHub 这个文件的类型,以便在下载时正确处理它。
# endregion
# -------------------Windows end
# region ------------Linux start
- name: Upload Build Artifact to Release (Linux x64) (TARGZ)
uses: actions/upload-release-asset@v1 # 安装用于上传最终打包结果到本次release的脚本
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ needs.build.outputs.INSTALLER_NAME_X64_TARGZ }}
asset_name: ${{ needs.build.outputs.INSTALLER_NAME_X64_TARGZ }}
asset_content_type: application/gzip
- name: Upload Build Artifact to Release (Linux x64) (APPIMAGE)
uses: actions/upload-release-asset@v1 # 安装用于上传最终打包结果到本次release的脚本
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ needs.build.outputs.INSTALLER_NAME_X64_APPIMAGE }}
asset_name: ${{ needs.build.outputs.INSTALLER_NAME_X64_APPIMAGE }}
asset_content_type: application/x-appimage
- name: Upload Build Artifact to Release (Linux x64) (DEB)
uses: actions/upload-release-asset@v1 # 安装用于上传最终打包结果到本次release的脚本
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ needs.build.outputs.INSTALLER_NAME_X64_DEB }}
asset_name: ${{ needs.build.outputs.INSTALLER_NAME_X64_DEB }}
asset_content_type: application/x-debian-package
# endregion
# -------------------Linux end
# region ------------MacOS start
- name: Upload Build Artifact to Release (MacOS x64) (DMG)
uses: actions/upload-release-asset@v1 # 安装用于上传最终打包结果到本次release的脚本
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ needs.build.outputs.INSTALLER_NAME_X64_DMG }}
asset_name: ${{ needs.build.outputs.INSTALLER_NAME_X64_DMG }}
asset_content_type: application/gzip
# endregion
# -------------------MacOS end
# endregion
############################################ Upload Build Artifact to Release ############################# end
######################################################################################################### build win
# build_windows_x64:
# runs-on: windows-latest # 指定虚拟机
# build_windows_arm64: # TIPS: github actions 的官方运行器暂不提供arm架构下的, win和linux系统环境。 如有需要, 只能自定义运行器。
######################################################################################################### build linux
# build_linux_x64:
# runs-on: linux-latest # 指定虚拟机
# build_linux_arm64: # TIPS: github actions 的官方运行器暂不提供arm架构下的, win和linux系统环境。 如有需要, 只能自定义运行器。
######################################################################################################### build macos
# build_macos_x64:
# runs-on: macos-13 # 指定虚拟机
# build_macos_arm64:
# runs-on: macos-latest # 指定虚拟机 macos14
######################################################################################################### build macos