Skip to content

Merge pull request #50 from ledhed2222/build-and-deps #4

Merge pull request #50 from ledhed2222/build-and-deps

Merge pull request #50 from ledhed2222/build-and-deps #4

name: Build Native Installers
on:
push:
tags:
- 'v*' # Only builds on version tags like v2.4.3
workflow_dispatch: # Manual trigger from the GitHub UI
jobs:
macos:
runs-on: macos-latest # ARM runner (Apple Silicon, works on Intel via Rosetta 2)
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Extract version from pom.xml
id: version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Build .jar
run: mvn clean package
- name: Run jpackage for macOS
run: |
jpackage \
--type dmg \
--name EWItool \
--input target \
--main-jar EWItool-${{ steps.version.outputs.version }}.jar \
--main-class com.github.ledhed2222.ewitool.Main \
--dest target \
--app-version ${{ steps.version.outputs.version }} \
--vendor "Ledhed2222" \
--icon src/main/resources/logo.icns
- name: Rename DMG
run: |
mv target/EWItool-${{ steps.version.outputs.version }}.dmg target/EWItool-${{ steps.version.outputs.version }}-macos.dmg
- name: Upload to gh release
uses: softprops/action-gh-release@v1
with:
files: target/*-macos.dmg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Extract version from pom.xml
id: version
shell: pwsh
run: |
[xml]$pom = Get-Content pom.xml
$VERSION = $pom.project.version
echo "version=$VERSION" >> $env:GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Build .jar
run: mvn clean package
- name: Convert PNG to ICO for Windows
run: |
# jpackage will use PNG on Windows if ICO not available
# We'll use the PNG file directly
- name: Run jpackage for Windows
run: |
jpackage `
--type exe `
--name EWItool `
--input target `
--main-jar EWItool-${{ steps.version.outputs.version }}.jar `
--main-class com.github.ledhed2222.ewitool.Main `
--dest target `
--app-version ${{ steps.version.outputs.version }} `
--vendor "Ledhed2222" `
--icon src/main/resources/logo.png `
--win-dir-chooser `
--win-menu `
--win-shortcut
- name: Upload to gh release
uses: softprops/action-gh-release@v1
with:
files: target/*.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Extract version from pom.xml
id: version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Install jpackage dependencies
run: |
sudo apt-get update
sudo apt-get install -y libfreetype6-dev libasound2-dev fakeroot rpm
- name: Build .jar
run: mvn clean package
- name: Run jpackage for Linux (DEB)
run: |
jpackage \
--type deb \
--name ewitool \
--input target \
--main-jar EWItool-${{ steps.version.outputs.version }}.jar \
--main-class com.github.ledhed2222.ewitool.Main \
--dest target \
--app-version ${{ steps.version.outputs.version }} \
--vendor "Ledhed2222" \
--icon src/main/resources/logo.png \
--linux-shortcut
- name: Run jpackage for Linux (RPM)
run: |
jpackage \
--type rpm \
--name ewitool \
--input target \
--main-jar EWItool-${{ steps.version.outputs.version }}.jar \
--main-class com.github.ledhed2222.ewitool.Main \
--dest target \
--app-version ${{ steps.version.outputs.version }} \
--vendor "Ledhed2222" \
--icon src/main/resources/logo.png \
--linux-shortcut
- name: Upload to gh release
uses: softprops/action-gh-release@v1
with:
files: |
target/*.deb
target/*.rpm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}