-
Notifications
You must be signed in to change notification settings - Fork 22
246 lines (207 loc) · 7.34 KB
/
build-desktop.yml
File metadata and controls
246 lines (207 loc) · 7.34 KB
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
name: Build Desktop Apps
on:
workflow_dispatch:
push:
tags: [ "v*" ]
permissions:
contents: write
jobs:
build-macos-arm64:
name: Build MacOS (Apple Silicon)
runs-on: macos-26
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build MacOS DMG (Apple Silicon)
# 执行 Compose Desktop 的打包任务
run: ./gradlew :composeApp:packageReleaseDmg
- name: Upload DMG Artifact
uses: actions/upload-artifact@v4
with:
name: MacOS-App-DMG-arm64
# 上传生成的 DMG 文件
path: composeApp/build/compose/binaries/**/*.dmg
if-no-files-found: error
build-macos-x64:
name: Build MacOS (Intel)
runs-on: macos-15-intel
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build MacOS DMG (Intel)
# 执行 Compose Desktop 的打包任务
run: ./gradlew :composeApp:packageReleaseDmg
- name: Upload DMG Artifact
uses: actions/upload-artifact@v4
with:
name: MacOS-App-DMG-amd64
# 上传生成的 DMG 文件
path: composeApp/build/compose/binaries/**/*.dmg
if-no-files-found: error
build-linux-deb-x64:
name: Build Linux Deb (x64)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Install Linux Dependencies
run: |
sudo apt-get update
sudo apt-get install -y fakeroot
- name: Build Linux Deb
# 执行 Compose Desktop 的打包任务
run: ./gradlew :composeApp:packageReleaseDeb
- name: Upload Deb Artifact
uses: actions/upload-artifact@v4
with:
name: Linux-App-Deb-x64
# 上传生成的 Deb 文件
path: composeApp/build/compose/binaries/**/*.deb
if-no-files-found: error
build-windows-x64:
name: Build Windows (x64)
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Create Release Distributable
run: ./gradlew :composeApp:createReleaseDistributable
- name: Setup Inno Setup
run: |
choco install innosetup
- name: Extract App Version
shell: powershell
run: |
$content = Get-Content composeApp/build.gradle.kts
$versionLine = $content | Select-String 'val appVersion = "(.*)"'
if ($versionLine) {
$version = $versionLine.Matches.Groups[1].Value
echo "APP_VERSION=$version" >> $env:GITHUB_ENV
} else {
Write-Error "Could not find appVersion in build.gradle.kts"
exit 1
}
- name: Build Installer with Inno Setup
# 显式传入 amd64 架构参数和版本号
run: iscc /DMyAppArch=amd64 /DMyAppVersion=${{ env.APP_VERSION }} installer/setup.iss
- name: Upload Windows Artifact
uses: actions/upload-artifact@v4
with:
name: Windows-App-Exe-amd64
path: installer/*_amd64_*.exe
if-no-files-found: error
# build-windows-arm64:
# name: Build Windows (ARM64)
# runs-on: windows-latest # 注意:目前 GitHub Hosted Runner 主要是 x64,这里生成的包可能仍然包含 x64 JVM,除非手动配置交叉编译
#
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: Set up JDK 17
# uses: actions/setup-java@v4
# with:
# java-version: '17'
# distribution: 'temurin'
#
# - name: Setup Gradle
# uses: gradle/actions/setup-gradle@v3
#
# - name: Create Release Distributable
# run: ./gradlew :composeApp:createReleaseDistributable
#
# - name: Setup Inno Setup
# run: |
# choco install innosetup
#
# - name: Build Installer with Inno Setup
# # 显式传入 aarch64 架构参数,这将影响生成的安装包文件名
# run: iscc /DMyAppArch=aarch64 installer/setup.iss
#
# - name: Upload Windows Artifact
# uses: actions/upload-artifact@v4
# with:
# name: Windows-App-Exe-arm64
# path: installer/*_aarch64_*.exe
# if-no-files-found: error
release:
name: Create Release
needs: [build-macos-arm64, build-macos-x64, build-linux-deb-x64, build-windows-x64]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R artifacts
- name: Generate Release Body
id: release_body
shell: bash
run: |
if [[ "${{ github.ref }}" =~ [Aa]lpha ]]; then
{
echo "WARNING_TEXT<<EOF"
echo "1.支持对字幕时移、位置和字号大小进行调整 "
echo "2.增强 ASS 字幕特效的渲染效果 "
echo "3.增加窗口置顶功能 "
echo "4.其他 UI 方面的优化 "
echo " "
echo "感谢以下飞牛共建团队成员在内测期间提供了宝贵的技术支持和建议: "
echo "@[玉尺书生](https://club.fnnas.com/home.php?mod=space&uid=6482) @[MR_XIAOBO](https://github.com/xiaobonet) @[汪仔饭](https://club.fnnas.com/home.php?mod=space&uid=5021) @*观如 "
echo " "
echo "**当前应用中没有展示出来或者点击没有反应的就是还没做的功能,后面陆续都会实现,请仅对已实现的功能提出合理意见** "
echo "> **此版本为开发中的版本,请酌情下载安装。**"
echo ""
echo "EOF"
} >> $GITHUB_ENV
else
echo "WARNING_TEXT=" >> $GITHUB_ENV
fi
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/**/*
# 如果 tag 包含 '-' (如 v1.0.0-alpha),则标记为预发布 (Pre-release)
prerelease: ${{ contains(github.ref, '-') }}
body: |
${{ env.WARNING_TEXT }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}