Update deploy.yml #27
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: Deploy | |
on: | |
push: | |
branches: [main] | |
permissions: | |
contents: write | |
jobs: | |
build-linux: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Set version | |
run: echo "VERSION=${{ github.run_number }}" >> $GITHUB_ENV | |
- name: Build with Maven | |
run: mvn versions:set -DnewVersion=${{ env.VERSION }} && mvn package -DskipTests | |
- name: Install jpackage dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y fakeroot libfuse2 | |
- name: Create DEB package | |
run: | | |
jpackage \ | |
--input target/ \ | |
--name LSOListGenerator \ | |
--main-jar LSOListGenerator-${{ env.VERSION }}.jar \ | |
--main-class pl.bator.lso_list_generator.LSOListGeneratorApplication \ | |
--type deb \ | |
--icon src/main/resources/logo.png \ | |
--dest . \ | |
--app-version ${{ env.VERSION }} | |
- name: Upload DEB as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lso-deb | |
path: lsolistgenerator*.deb | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Set version | |
run: echo "VERSION=1.0.${{ github.run_number }}" >> $env:GITHUB_ENV | |
shell: pwsh | |
- name: Build with Maven | |
run: | | |
mvn versions:set -DnewVersion=${{ env.VERSION }} | |
mvn package -DskipTests | |
shell: pwsh | |
- name: Create MSI package | |
run: | | |
jpackage ` | |
--input target\ ` | |
--name LSOListGenerator ` | |
--main-jar LSOListGenerator-1-jar-with-dependencies.jar ` | |
--main-class "pl.bator.lso_list_generator.LSOListGeneratorApplication" ` | |
--type msi ` | |
--icon src\main\resources\logo.ico ` | |
--dest . ` | |
--app-version "1.0.26" ` | |
--win-shortcut ` | |
--win-upgrade-uuid "123e4567-e89b-12d3-a456-426614174000" | |
shell: pwsh | |
- name: Upload MSI as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lso-msi | |
path: LSOListGenerator*.msi | |
release: | |
needs: [build-linux, build-windows] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download DEB artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: lso-deb | |
- name: Download MSI artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: lso-msi | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: Release v${{ github.run_number }} | |
tag_name: v${{ github.run_number }} | |
files: | | |
lsolistgenerator*.deb | |
LSOListGenerator*.msi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |