Add GitHub CI #1
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: CI | |
| on: | |
| push: | |
| branches: [ master, main ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ master, main ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-linux: | |
| name: Build (Linux) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Temurin JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| cache: 'maven' | |
| - name: Build and test (headless) | |
| run: | | |
| mvn -B -Djavafx.platform=linux -DskipTests clean verify | |
| - name: Upload fat JAR | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: FDDTools-fat-jar | |
| path: target/FDDTools-*.jar | |
| package-macos: | |
| name: Package (macOS app-image) | |
| runs-on: macos-latest | |
| needs: build-linux | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Temurin JDK 21 (includes jpackage) | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| cache: 'maven' | |
| - name: Package app-image | |
| run: | | |
| mvn -B -DskipTests \ | |
| -Djavafx.platform=mac-aarch64 \ | |
| -Pmacos-app-image \ | |
| -DskipDmg=${{ startsWith(github.ref, 'refs/tags/v') && 'false' || 'true' }} \ | |
| verify | |
| - name: Upload app-image | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: FDDTools-macos-app-image | |
| path: target/dist/macos/app-image/** | |
| - name: Upload DMG (on tags) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: FDDTools-macos-dmg | |
| path: target/dist/macos/*.dmg | |
| release: | |
| name: Publish GitHub Release (DMG + JAR) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [package-macos] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download DMG artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: FDDTools-macos-dmg | |
| path: dist/macos | |
| - name: Download fat JAR artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: FDDTools-fat-jar | |
| path: dist/jar | |
| - name: Create Release and upload assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| dist/macos/*.dmg | |
| dist/jar/*.jar | |
| generate_release_notes: true |