File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build MacOS App
2+
3+ on :
4+ workflow_dispatch : # 允许手动触发
5+ push :
6+ branches : [ "main", "master" ] # 推送到主分支时触发
7+ pull_request :
8+ branches : [ "main", "master" ]
9+
10+ jobs :
11+ build :
12+ name : Build MacOS DMG (Apple Silicon)
13+ runs-on : macos-14 # 指定使用 M 系列芯片 (Apple Silicon) 的 runner
14+
15+ steps :
16+ - name : Checkout code
17+ uses : actions/checkout@v4
18+
19+ - name : Set up JDK 17
20+ uses : actions/setup-java@v4
21+ with :
22+ java-version : ' 17'
23+ distribution : ' temurin'
24+
25+ - name : Setup Gradle
26+ uses : gradle/actions/setup-gradle@v3
27+
28+ - name : Grant execute permission for gradlew
29+ run : chmod +x gradlew
30+
31+ - name : Build MacOS DMG
32+ # 执行 Compose Desktop 的打包任务
33+ run : ./gradlew :composeApp:packageReleaseDmg
34+
35+ - name : List build artifacts
36+ run : |
37+ find composeApp/build/compose/binaries -name "*.dmg"
38+
39+ - name : Upload DMG Artifact
40+ uses : actions/upload-artifact@v4
41+ with :
42+ name : MacOS-App-DMG
43+ # 上传生成的 DMG 文件,路径根据 build.gradle.kts 的重命名逻辑可能会有所不同,这里使用通配符匹配
44+ path : composeApp/build/compose/binaries/**/*.dmg
45+ if-no-files-found : error
You can’t perform that action at this time.
0 commit comments