Update GitHub Actions workflow for builds and releases #8
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 Installers | ||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| tags: [ "v*" ] # This ensures the workflow triggers when you push a tag | ||
| pull_request: | ||
| branches: [ "main" ] | ||
| jobs: | ||
| build: | ||
| name: Build on ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [macos-latest, ubuntu-latest] | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up JDK 25 | ||
| uses: uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '25' | ||
| distribution: 'oracle' | ||
| - name: Install Linux Dependencies | ||
| if: runner.os == 'Linux' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y ant fakeroot dpkg-dev | ||
| - name: Run Ant Package | ||
| run: ant package | ||
| - name: Upload Artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ matrix.os }}-installer | ||
| path: dist/ | ||
| # This must be aligned exactly with "build:" | ||
| release: | ||
| name: Create GitHub Release | ||
| needs: build | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: artifacts | ||
| merge-multiple: true | ||
| - name: Create Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| files: | | ||
| artifacts/*.dmg | ||
| artifacts/*.deb | ||
| body: "Automatic build of ${{ github.ref_name }}" | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||