Skip to content

Commit 888db01

Browse files
committed
refactor: Simplify and consolidate GitHub Actions build workflow
This commit refactors the `build-desktop.yml` GitHub Actions workflow to streamline the build and release process. - **Permissions:** Adds `contents: write` permission to allow the `release` job to create a GitHub Release and upload artifacts. - **Build Matrix Simplification:** Consolidates the build matrix by removing redundant entries for each specific package format (`dmg`, `pkg`, `msi`, `deb`). Instead, it now uses a single entry per operating system (`macos`, `windows`, `linux`). - **Gradle Task Consolidation:** Replaces specific Gradle tasks like `packageDmg`, `packageMsi`, etc., with the more general `packageDistributionForCurrentOS`. This task automatically builds all configured native distribution formats for the running OS. - **Artifact Generation:** Adds `packageUberJarForCurrentOS` to the build step to ensure a standalone "fat" JAR is created for all platforms. - **Release Artifact Paths:** Updates the artifact upload and release attachment paths to correctly locate all generated packages (`.dmg`, `.pkg`, `.msi`, `.exe`, `.deb`, `.rpm`, `.jar`) from the unified build output directories.
1 parent 8f2b5ab commit 888db01

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

.github/workflows/build-desktop.yml

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
tags:
66
- 'v*' # Runs on version tags like v1.0.0
77

8+
permissions:
9+
contents: write
10+
811
jobs:
912
build:
1013
name: Build for ${{ matrix.os }}
@@ -13,20 +16,14 @@ jobs:
1316
matrix:
1417
include:
1518
- os: macos-latest
16-
format: dmg
17-
gradle_task: packageDmg
18-
- os: macos-latest
19-
format: pkg
20-
gradle_task: packagePkg
19+
format: macos
20+
gradle_task: packageDistributionForCurrentOS
2121
- os: windows-latest
22-
format: msi
23-
gradle_task: packageMsi
24-
- os: ubuntu-latest
25-
format: deb
26-
gradle_task: packageDeb
22+
format: windows
23+
gradle_task: packageDistributionForCurrentOS
2724
- os: ubuntu-latest
28-
format: jar
29-
gradle_task: jar
25+
format: linux
26+
gradle_task: packageDistributionForCurrentOS
3027

3128
steps:
3229
- name: Checkout code
@@ -42,8 +39,8 @@ jobs:
4239
if: runner.os != 'Windows'
4340
run: chmod +x gradlew
4441

45-
- name: Build native package
46-
run: ./gradlew ${{ matrix.gradle_task }} --stacktrace
42+
- name: Build native packages
43+
run: ./gradlew ${{ matrix.gradle_task }} packageUberJarForCurrentOS --stacktrace
4744

4845
- name: Check build output
4946
run: ls -R composeApp/build || true
@@ -53,7 +50,11 @@ jobs:
5350
with:
5451
name: build-${{ matrix.format }}
5552
path: |
56-
composeApp/build/compose/binaries/**/${{ matrix.format }}/
53+
composeApp/build/compose/binaries/**/dmg/*
54+
composeApp/build/compose/binaries/**/pkg/*
55+
composeApp/build/compose/binaries/**/deb/*
56+
composeApp/build/compose/binaries/**/msi/*
57+
composeApp/build/compose/binaries/**/app/*
5758
composeApp/build/compose/jars/*.jar
5859
5960
release:
@@ -74,13 +75,14 @@ jobs:
7475
uses: softprops/action-gh-release@v2
7576
with:
7677
files: |
77-
artifacts/build-app/*.app
78-
artifacts/build-dmg/*.dmg
79-
artifacts/build-pkg/*.pkg
80-
artifacts/build-msi/*.msi
81-
artifacts/build-rpm/*.rpm
82-
artifacts/build-deb/*.deb
83-
artifacts/build-jar/*.jar
78+
artifacts/build-macos/**/*.dmg
79+
artifacts/build-macos/**/*.app
80+
artifacts/build-macos/**/*.pkg
81+
artifacts/build-windows/**/*.msi
82+
artifacts/build-windows/**/*.exe
83+
artifacts/build-linux/**/*.deb
84+
artifacts/build-linux/**/*.rpm
85+
artifacts/build-linux/**/*.jar
8486
draft: true
8587
tag_name: ${{ github.ref_name }}
8688
env:

0 commit comments

Comments
 (0)