Native Builds Dependency Fix #6
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Native Executables | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| include: | |
| - os: ubuntu-latest | |
| platform: linux | |
| extension: deb | |
| - os: windows-latest | |
| platform: windows | |
| extension: exe | |
| - os: macos-latest | |
| platform: macos | |
| extension: dmg | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 23 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '23' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Build regular JAR with Maven (for jpackage) | |
| run: mvn clean package -DskipTests | |
| - name: Copy dependencies for jpackage | |
| run: mvn dependency:copy-dependencies -DoutputDirectory=target/libs | |
| - name: Build Windows Installer | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| jpackage ` | |
| --type exe ` | |
| --input target ` | |
| --dest dist ` | |
| --name jGB ` | |
| --main-jar jgb-1.0-SNAPSHOT.jar ` | |
| --main-class Emulator ` | |
| --module-path "target/libs" ` | |
| --add-modules javafx.controls,javafx.fxml ` | |
| --app-version 1.0 ` | |
| --description "Game Boy Emulator" ` | |
| --vendor "Dominik Kolak" ` | |
| --win-dir-chooser ` | |
| --win-menu ` | |
| --win-shortcut ` | |
| --java-options "-Xmx1024m" | |
| shell: pwsh | |
| - name: Build macOS Installer | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| jpackage \ | |
| --type dmg \ | |
| --input target \ | |
| --dest dist \ | |
| --name jGB \ | |
| --main-jar jgb-1.0-SNAPSHOT.jar \ | |
| --main-class Emulator \ | |
| --module-path "target/libs" \ | |
| --add-modules javafx.controls,javafx.fxml \ | |
| --app-version 1.0 \ | |
| --description "Game Boy Emulator" \ | |
| --vendor "Dominik Kolak" \ | |
| --mac-package-name jGB \ | |
| --java-options "-Xmx1024m" | |
| - name: Build Linux Installer | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| jpackage \ | |
| --type deb \ | |
| --input target \ | |
| --dest dist \ | |
| --name jgb \ | |
| --main-jar jgb-1.0-SNAPSHOT.jar \ | |
| --main-class Emulator \ | |
| --module-path "target/libs" \ | |
| --add-modules javafx.controls,javafx.fxml \ | |
| --app-version 1.0 \ | |
| --description "Game Boy Emulator" \ | |
| --vendor "Dominik Kolak" \ | |
| --linux-shortcut \ | |
| --linux-menu-group "Games" \ | |
| --java-options "-Xmx1024m" | |
| - name: List dist directory (debug) | |
| run: ls -la dist | |
| shell: bash | |
| - name: Upload Installer | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jGB-${{ matrix.platform }}-installer | |
| path: dist/*.${{ matrix.extension }} | |
| if-no-files-found: error | |
| build-fat-jar: | |
| name: Build Fat JAR | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 23 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '23' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Build Fat JAR | |
| run: mvn clean package -P fat-jar -DskipTests | |
| - name: Rename Fat JAR | |
| run: mv target/jgb-1.0-SNAPSHOT-fat.jar target/jgb-1.0-SNAPSHOT-standalone.jar | |
| - name: Upload Fat JAR | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jGB-standalone-jar | |
| path: target/jgb-1.0-SNAPSHOT-standalone.jar | |
| if-no-files-found: error | |
| create-release: | |
| name: Create GitHub Release | |
| needs: [build, build-fat-jar] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: installers | |
| - name: Display structure of downloaded files | |
| run: ls -R installers | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: installers/**/* | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| body: | | |
| ## Download Options | |
| ### Native Installers (Recommended) | |
| - **Windows**: `jGB-windows-installer/*.exe` | |
| - **macOS**: `jGB-macos-installer/*.dmg` | |
| - **Linux**: `jGB-linux-installer/*.deb` | |
| ### Standalone JAR | |
| - **All Platforms**: `jGB-standalone-jar/jgb-1.0-SNAPSHOT-standalone.jar` | |
| - Requires Java 23+ with JavaFX | |
| - Run with: `java -jar jgb-1.0-SNAPSHOT-standalone.jar` | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |