Update pom.xml #4
Workflow file for this run
This file contains 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: Create Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get_version.outputs.version }} | |
steps: | |
- name: Get version from tag | |
id: get_version | |
run: | | |
# Convert v1.0.3 to 1.0.3 | |
VERSION=${GITHUB_REF#refs/tags/v} | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
build: | |
needs: prepare | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
include: | |
- os: windows-latest | |
artifact_name: Sudoku-windows.zip | |
- os: ubuntu-latest | |
artifact_name: Sudoku-linux.zip | |
- os: macos-latest | |
artifact_name: Sudoku-mac.zip | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '23' | |
distribution: 'oracle' | |
cache: maven | |
- name: Update version in pom.xml | |
run: | | |
mvn versions:set -DnewVersion=${{ needs.prepare.outputs.version }} | |
mvn versions:commit | |
- name: Build with Maven | |
run: mvn clean package -Pnative-image | |
# Windows-specific steps | |
- name: Build Windows Package | |
if: matrix.os == 'windows-latest' | |
shell: pwsh | |
run: | | |
jpackage --input target/ ` | |
--main-jar Sudoku.jar ` | |
--main-class App ` | |
--type exe ` | |
--name Sudoku ` | |
--app-version ${{ needs.prepare.outputs.version }} ` | |
--win-dir-chooser ` | |
--win-menu ` | |
--win-shortcut ` | |
--icon src/main/resources/icon.ico | |
Compress-Archive -Path .\Sudoku.exe -DestinationPath ${{ matrix.artifact_name }} | |
# Linux-specific steps | |
- name: Build Linux Package | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
jpackage --input target/ \ | |
--main-jar Sudoku.jar \ | |
--main-class App \ | |
--type deb \ | |
--name Sudoku \ | |
--app-version ${{ needs.prepare.outputs.version }} | |
zip -r ${{ matrix.artifact_name }} *.deb | |
# macOS-specific steps | |
- name: Build macOS Package | |
if: matrix.os == 'macos-latest' | |
run: | | |
jpackage --input target/ \ | |
--main-jar Sudoku.jar \ | |
--main-class App \ | |
--type dmg \ | |
--name Sudoku \ | |
--app-version ${{ needs.prepare.outputs.version }} \ | |
--mac-package-name Sudoku | |
zip -r ${{ matrix.artifact_name }} *.dmg | |
- name: Upload Release Assets | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
${{ matrix.artifact_name }} | |
target/Sudoku.jar | |
name: Release ${{ needs.prepare.outputs.version }} | |
draft: false | |
prerelease: false | |
token: ${{ secrets.GITHUB_TOKEN }} |