-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (86 loc) · 3.29 KB
/
build-debug.yml
File metadata and controls
105 lines (86 loc) · 3.29 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
name: Build Debug
# 触发条件:PR 和推送到主分支
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
jobs:
build-android:
name: Build Android Debug APK
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build debug APK
run: ./gradlew :androidApp:assembleDebug --stacktrace
- name: Upload debug APK
uses: actions/upload-artifact@v4
with:
name: android-debug-apk
path: androidApp/build/outputs/apk/debug/androidApp-debug.apk
retention-days: 7
- name: Build info
run: |
echo "✓ Android Debug APK built successfully"
echo "📦 Artifact: androidApp-debug.apk"
echo "🔐 Signing: Debug keystore (for development only)"
ls -lh androidApp/build/outputs/apk/debug/
build-desktop:
name: Build Desktop Debug (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew (Unix)
if: matrix.os != 'windows-latest'
run: chmod +x gradlew
# 使用 packageDistributionForCurrentOS 只打包当前平台
- name: Build platform-specific package (Unix)
run: ./gradlew :composeApp:packageDistributionForCurrentOS --stacktrace
if: matrix.os != 'windows-latest'
- name: Build platform-specific package (Windows)
run: .\gradlew.bat :composeApp:packageDistributionForCurrentOS --stacktrace
if: matrix.os == 'windows-latest'
# 停止 Gradle daemon 以避免文件锁定问题
- name: Stop Gradle daemon (Unix)
if: matrix.os != 'windows-latest' && always()
run: ./gradlew --stop
- name: Stop Gradle daemon (Windows)
if: matrix.os == 'windows-latest' && always()
run: .\gradlew.bat --stop
- name: Upload Desktop distributable
uses: actions/upload-artifact@v4
with:
name: desktop-debug-dist-${{ matrix.os }}
path: composeApp/build/compose/binaries/main/**/*
retention-days: 7
- name: Build info (Unix)
if: matrix.os != 'windows-latest'
run: |
echo "✓ Desktop Debug build successful for ${{ matrix.os }}"
echo "📦 Distributable:"
ls -lh composeApp/build/compose/binaries/main/ || echo "Distributable not created"
- name: Build info (Windows)
if: matrix.os == 'windows-latest'
run: |
echo "✓ Desktop Debug build successful for ${{ matrix.os }}"
echo "📦 Distributable:"
dir composeApp\build\compose\binaries\main\ || echo "Distributable not created"