Fix fat jar: Launcher class + cross-platform JavaFX natives; add CI f… #1
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: Release artifacts | |
| # Triggered either by pushing a v*.*.* tag, or manually from the Actions tab. | |
| # On tag push the resulting artefacts are uploaded directly to that release. | |
| # On manual dispatch they're kept as workflow artefacts for testing. | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write # required to upload release assets | |
| jobs: | |
| fat-jar: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '21' | |
| - name: Build fat jar | |
| run: ./gradlew shadowJar | |
| - name: Rename for release clarity | |
| run: mv build/libs/BytecodeLens-*-all.jar build/libs/BytecodeLens-all.jar | |
| - name: Upload to release (on tag) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: build/libs/BytecodeLens-all.jar | |
| - name: Upload as workflow artefact (manual runs) | |
| if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: BytecodeLens-fat-jar | |
| path: build/libs/BytecodeLens-*-all.jar | |
| native-installers: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| jpackage-type: msi | |
| suffix: windows-x64.msi | |
| - os: macos-13 # Intel | |
| jpackage-type: dmg | |
| suffix: macos-x64.dmg | |
| - os: macos-latest # Apple Silicon | |
| jpackage-type: dmg | |
| suffix: macos-aarch64.dmg | |
| - os: ubuntu-latest | |
| jpackage-type: deb | |
| suffix: linux-x64.deb | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '21' | |
| - name: Build runtime jar (non-shadow — jpackage adds its own deps) | |
| run: ./gradlew jar | |
| - name: Collect runtime classpath | |
| shell: bash | |
| run: | | |
| mkdir -p build/jpackage-input | |
| cp build/libs/BytecodeLens-*.jar build/jpackage-input/app.jar | |
| # Pull every runtime dep + cross-platform JavaFX natives into a single folder. | |
| ./gradlew -q copyRuntimeDeps | |
| - name: Run jpackage (Windows .msi) | |
| if: matrix.os == 'windows-latest' | |
| shell: bash | |
| run: | | |
| jpackage \ | |
| --type msi \ | |
| --name BytecodeLens \ | |
| --app-version ${{ github.ref_name == '' && '1.0.0' || github.ref_name }} \ | |
| --vendor "BytecodeLens" \ | |
| --description "The Java RE cockpit" \ | |
| --input build/jpackage-input \ | |
| --main-jar app.jar \ | |
| --main-class dev.share.bytecodelens.Launcher \ | |
| --icon icons/BytecodeLens-C1-avatar-512.png \ | |
| --win-shortcut \ | |
| --win-menu \ | |
| --dest build/installers | |
| - name: Run jpackage (macOS .dmg) | |
| if: startsWith(matrix.os, 'macos') | |
| shell: bash | |
| run: | | |
| jpackage \ | |
| --type dmg \ | |
| --name BytecodeLens \ | |
| --app-version ${{ github.ref_name == '' && '1.0.0' || github.ref_name }} \ | |
| --vendor "BytecodeLens" \ | |
| --description "The Java RE cockpit" \ | |
| --input build/jpackage-input \ | |
| --main-jar app.jar \ | |
| --main-class dev.share.bytecodelens.Launcher \ | |
| --icon icons/BytecodeLens-C1-avatar-512.png \ | |
| --dest build/installers | |
| - name: Run jpackage (Linux .deb) | |
| if: matrix.os == 'ubuntu-latest' | |
| shell: bash | |
| run: | | |
| jpackage \ | |
| --type deb \ | |
| --name bytecodelens \ | |
| --app-version ${{ github.ref_name == '' && '1.0.0' || github.ref_name }} \ | |
| --vendor "BytecodeLens" \ | |
| --description "The Java RE cockpit" \ | |
| --input build/jpackage-input \ | |
| --main-jar app.jar \ | |
| --main-class dev.share.bytecodelens.Launcher \ | |
| --icon icons/BytecodeLens-C1-avatar-512.png \ | |
| --linux-shortcut \ | |
| --dest build/installers | |
| - name: Rename installer for clarity | |
| shell: bash | |
| run: | | |
| cd build/installers | |
| original=$(ls *) | |
| mv "$original" "BytecodeLens-${{ matrix.suffix }}" | |
| - name: Upload to release (on tag) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: build/installers/BytecodeLens-${{ matrix.suffix }} | |
| - name: Upload as workflow artefact (manual runs) | |
| if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: BytecodeLens-${{ matrix.suffix }} | |
| path: build/installers/BytecodeLens-${{ matrix.suffix }} |