Skip to content

Commit fb501f9

Browse files
authored
Merge pull request #280 from rainxchzed/generate-installers
2 parents 5a60d46 + edeb305 commit fb501f9

File tree

1 file changed

+81
-55
lines changed

1 file changed

+81
-55
lines changed

.github/workflows/build-desktop-platforms.yml

Lines changed: 81 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ env:
1616
-Dorg.gradle.daemon=false
1717
-Dorg.gradle.parallel=true
1818
-Dorg.gradle.caching=true
19+
-Dorg.gradle.vfs.watch=false
1920
2021
jobs:
2122
build-windows:
@@ -25,47 +26,38 @@ jobs:
2526
- name: Checkout code
2627
uses: actions/checkout@v4
2728

29+
- name: Validate Gradle wrapper
30+
uses: gradle/actions/wrapper-validation@v4
31+
2832
- name: Set up JDK ${{ env.JAVA_VERSION }}
2933
uses: actions/setup-java@v4
3034
with:
3135
distribution: ${{ env.JAVA_DISTRIBUTION }}
3236
java-version: ${{ env.JAVA_VERSION }}
33-
cache: 'gradle'
3437

3538
- name: Setup Gradle
3639
uses: gradle/actions/setup-gradle@v4
3740
with:
3841
cache-read-only: false
3942
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
43+
gradle-home-cache-cleanup: true
4044

4145
- name: Grant execute permission for gradlew
4246
run: chmod +x gradlew
4347
shell: bash
4448

45-
- name: Build Windows installers (EXE & MSI) with retries
49+
- name: Build Windows installers (EXE & MSI)
4650
run: |
4751
set -euo pipefail
48-
4952
retry() {
50-
local n=1
51-
local max=3
52-
local delay=5
53+
local n=1 max=3 delay=5
5354
while true; do
5455
echo "Attempt #$n: $*"
55-
if "$@"; then
56-
break
57-
fi
58-
if [ $n -ge $max ]; then
59-
echo "Command failed after $n attempts."
60-
return 1
61-
fi
62-
n=$((n+1))
63-
echo "Command failed — retrying in $delay seconds..."
64-
sleep $delay
65-
delay=$((delay*2))
56+
"$@" && break
57+
[ $n -ge $max ] && { echo "Failed after $n attempts."; return 1; }
58+
n=$((n+1)); echo "Retrying in ${delay}s..."; sleep $delay; delay=$((delay*2))
6659
done
6760
}
68-
6961
retry ./gradlew :composeApp:packageExe :composeApp:packageMsi
7062
shell: bash
7163

@@ -94,46 +86,37 @@ jobs:
9486
- name: Checkout code
9587
uses: actions/checkout@v4
9688

89+
- name: Validate Gradle wrapper
90+
uses: gradle/actions/wrapper-validation@v4
91+
9792
- name: Set up JDK ${{ env.JAVA_VERSION }}
9893
uses: actions/setup-java@v4
9994
with:
10095
distribution: ${{ env.JAVA_DISTRIBUTION }}
10196
java-version: ${{ env.JAVA_VERSION }}
102-
cache: 'gradle'
10397

10498
- name: Setup Gradle
10599
uses: gradle/actions/setup-gradle@v4
106100
with:
107101
cache-read-only: false
108102
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
103+
gradle-home-cache-cleanup: true
109104

110105
- name: Grant execute permission for gradlew
111106
run: chmod +x gradlew
112107

113-
- name: Build macOS installers (DMG & PKG) with retries
108+
- name: Build macOS installers (DMG & PKG)
114109
run: |
115110
set -euo pipefail
116-
117111
retry() {
118-
local n=1
119-
local max=3
120-
local delay=5
112+
local n=1 max=3 delay=5
121113
while true; do
122114
echo "Attempt #$n: $*"
123-
if "$@"; then
124-
break
125-
fi
126-
if [ $n -ge $max ]; then
127-
echo "Command failed after $n attempts."
128-
return 1
129-
fi
130-
n=$((n+1))
131-
echo "Command failed — retrying in $delay seconds..."
132-
sleep $delay
133-
delay=$((delay*2))
115+
"$@" && break
116+
[ $n -ge $max ] && { echo "Failed after $n attempts."; return 1; }
117+
n=$((n+1)); echo "Retrying in ${delay}s..."; sleep $delay; delay=$((delay*2))
134118
done
135119
}
136-
137120
retry ./gradlew :composeApp:packageDmg :composeApp:packagePkg
138121
shell: bash
139122

@@ -153,57 +136,90 @@ jobs:
153136
include:
154137
- os: ubuntu-latest
155138
label: modern
139+
gradle-tasks: >-
140+
:composeApp:packageDeb
141+
:composeApp:packageRpm
142+
:composeApp:packageAppImage
156143
157144
- os: ubuntu-22.04
158145
label: debian12-compat
146+
gradle-tasks: >-
147+
:composeApp:packageDeb
148+
:composeApp:packageRpm
159149
160150
runs-on: ${{ matrix.os }}
161151

162152
steps:
163153
- name: Checkout code
164154
uses: actions/checkout@v4
165155

156+
- name: Validate Gradle wrapper
157+
uses: gradle/actions/wrapper-validation@v4
158+
166159
- name: Set up JDK ${{ env.JAVA_VERSION }}
167160
uses: actions/setup-java@v4
168161
with:
169162
distribution: ${{ env.JAVA_DISTRIBUTION }}
170163
java-version: ${{ env.JAVA_VERSION }}
171-
cache: 'gradle'
172164

173165
- name: Setup Gradle
174166
uses: gradle/actions/setup-gradle@v4
175167
with:
176168
cache-read-only: false
177169
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
170+
gradle-home-cache-cleanup: true
178171

179172
- name: Grant execute permission for gradlew
180173
run: chmod +x gradlew
181174

182-
- name: Build Linux installers (DEB & RPM) with retries
175+
- name: Build Linux installers
183176
run: |
184177
set -euo pipefail
185-
186178
retry() {
187-
local n=1
188-
local max=3
189-
local delay=5
179+
local n=1 max=3 delay=5
190180
while true; do
191181
echo "Attempt #$n: $*"
192-
if "$@"; then
193-
break
194-
fi
195-
if [ $n -ge $max ]; then
196-
echo "Command failed after $n attempts."
197-
return 1
198-
fi
199-
n=$((n+1))
200-
echo "Command failed — retrying in $delay seconds..."
201-
sleep $delay
202-
delay=$((delay*2))
182+
"$@" && break
183+
[ $n -ge $max ] && { echo "Failed after $n attempts."; return 1; }
184+
n=$((n+1)); echo "Retrying in ${delay}s..."; sleep $delay; delay=$((delay*2))
203185
done
204186
}
187+
retry ./gradlew ${{ matrix.gradle-tasks }}
188+
shell: bash
205189

206-
retry ./gradlew :composeApp:packageDeb :composeApp:packageRpm
190+
- name: List AppImage build output
191+
if: matrix.label == 'modern'
192+
run: |
193+
echo "=== Listing build output ==="
194+
find composeApp/build/compose/binaries/main -maxdepth 3 -type d 2>/dev/null || echo "Directory not found"
195+
echo "=== All files ==="
196+
find composeApp/build/compose/binaries/main -maxdepth 4 -type f 2>/dev/null | head -30 || echo "No files found"
197+
shell: bash
198+
199+
- name: Package AppImage as tar.gz
200+
if: matrix.label == 'modern'
201+
run: |
202+
set -euo pipefail
203+
204+
# Find the app-image output directory (could be app-image/ or app/)
205+
APPIMAGE_DIR=""
206+
for dir in composeApp/build/compose/binaries/main/app-image composeApp/build/compose/binaries/main/app; do
207+
if [ -d "$dir" ]; then
208+
APPIMAGE_DIR="$dir"
209+
echo "Found AppImage output at: $dir"
210+
break
211+
fi
212+
done
213+
214+
if [ -z "$APPIMAGE_DIR" ]; then
215+
echo "ERROR: Could not find AppImage output directory"
216+
ls -la composeApp/build/compose/binaries/main/ || true
217+
exit 1
218+
fi
219+
220+
tar -czf composeApp/build/compose/binaries/main/GitHub-Store-linux-x64.tar.gz -C "$APPIMAGE_DIR" .
221+
echo "Created tar.gz archive:"
222+
ls -lh composeApp/build/compose/binaries/main/GitHub-Store-linux-x64.tar.gz
207223
shell: bash
208224

209225
- name: Upload Linux installers
@@ -214,4 +230,14 @@ jobs:
214230
composeApp/build/compose/binaries/main/deb/*.deb
215231
composeApp/build/compose/binaries/main/rpm/*.rpm
216232
retention-days: 30
217-
compression-level: 6
233+
compression-level: 6
234+
235+
- name: Upload Linux AppImage
236+
if: matrix.label == 'modern'
237+
uses: actions/upload-artifact@v4
238+
with:
239+
name: linux-appimage
240+
path: composeApp/build/compose/binaries/main/GitHub-Store-linux-x64.tar.gz
241+
if-no-files-found: error
242+
retention-days: 30
243+
compression-level: 6

0 commit comments

Comments
 (0)