Skip to content

Change desktop - main.kt to DesktopApp.kt #25

Change desktop - main.kt to DesktopApp.kt

Change desktop - main.kt to DesktopApp.kt #25

name: Build Desktop Platform Installers
on:
push:
branches:
- generate-installers
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
JAVA_VERSION: '21'
JAVA_DISTRIBUTION: 'temurin'
GRADLE_OPTS: >-
-Dorg.gradle.daemon=false
-Dorg.gradle.parallel=true
-Dorg.gradle.caching=true
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: false
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
shell: bash
- name: Build Windows installers (EXE & MSI) with retries
run: |
set -euo pipefail
retry() {
local n=1
local max=3
local delay=5
while true; do
echo "Attempt #$n: $*"
if "$@"; then
break
fi
if [ $n -ge $max ]; then
echo "Command failed after $n attempts."
return 1
fi
n=$((n+1))
echo "Command failed — retrying in $delay seconds..."
sleep $delay
delay=$((delay*2))
done
}
retry ./gradlew :composeApp:packageExe :composeApp:packageMsi
shell: bash
- name: Upload Windows installers
uses: actions/upload-artifact@v4
with:
name: windows-installers
path: |
composeApp/build/compose/binaries/main/exe/*.exe
composeApp/build/compose/binaries/main/msi/*.msi
retention-days: 30
compression-level: 6
build-macos:
strategy:
matrix:
include:
- os: macos-15-intel
arch: x64
- os: macos-latest
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: false
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build macOS installers (DMG & PKG) with retries
run: |
set -euo pipefail
retry() {
local n=1
local max=3
local delay=5
while true; do
echo "Attempt #$n: $*"
if "$@"; then
break
fi
if [ $n -ge $max ]; then
echo "Command failed after $n attempts."
return 1
fi
n=$((n+1))
echo "Command failed — retrying in $delay seconds..."
sleep $delay
delay=$((delay*2))
done
}
retry ./gradlew :composeApp:packageDmg :composeApp:packagePkg
shell: bash
- name: Upload macOS installers
uses: actions/upload-artifact@v4
with:
name: macos-installers-${{ matrix.arch }}
path: |
composeApp/build/compose/binaries/main/dmg/*.dmg
composeApp/build/compose/binaries/main/pkg/*.pkg
retention-days: 30
compression-level: 6
build-linux:
strategy:
matrix:
include:
- os: ubuntu-latest
label: modern
- os: ubuntu-22.04
label: debian12-compat
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: false
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Linux installers (DEB & RPM) with retries
run: |
set -euo pipefail
retry() {
local n=1
local max=3
local delay=5
while true; do
echo "Attempt #$n: $*"
if "$@"; then
break
fi
if [ $n -ge $max ]; then
echo "Command failed after $n attempts."
return 1
fi
n=$((n+1))
echo "Command failed — retrying in $delay seconds..."
sleep $delay
delay=$((delay*2))
done
}
retry ./gradlew :composeApp:packageDeb :composeApp:packageRpm
shell: bash
- name: Upload Linux installers
uses: actions/upload-artifact@v4
with:
name: linux-installers-${{ matrix.label }}
path: |
composeApp/build/compose/binaries/main/deb/*.deb
composeApp/build/compose/binaries/main/rpm/*.rpm
retention-days: 30
compression-level: 6