Skip to content

Implement HA Availability #159

Implement HA Availability

Implement HA Availability #159

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Build Windows Installer
env:
JAVA_VERSION: 19
on:
push:
branches: [ main ]
workflow_dispatch:
branches: [ main ]
jobs:
buildWindows:
runs-on: windows-latest
steps:
- name: Download Wix
uses: i3h/download-release-asset@v1
with:
owner: wixtoolset
repo: wix3
tag: wix3112rtm
file: wix311-binaries.zip
token: ${{ secrets.GITHUB_TOKEN }}
- name: Decompress Wix
run: 7z x wix311-binaries.zip "-o./target/wix"
- name: Add Wix to Path
run: echo "$HOME/target/wix" >> $GITHUB_PATH
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'liberica'
java-package: jdk+fx
cache: 'maven'
- name: Build with Maven
run: mvn -B clean install --file pom.xml
- name: Store artifact
uses: actions/upload-artifact@v3
with:
name: windows-installer
path: ./target/*.msi
buildLinux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'liberica'
java-package: jdk+fx
cache: 'maven'
- name: Build with Maven
run: mvn -B clean install --file pom.xml
- name: Store artifact
uses: actions/upload-artifact@v3
with:
name: linux-installer
path: |
./target/*.deb
./target/*.jar
preRelease:
name: Pre-release
needs:
- buildWindows
- buildLinux
runs-on: ubuntu-latest
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
- name: Extract Maven project version
run: echo "version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT
id: project
# Remove old pre-releases
- name: Remove Old Pre-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api repos/{owner}/{repo}/releases \
--jq '.[] | select(.prerelease == true) | .id' \
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
- name: Remove previous tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api --method DELETE -H "Accept: application/vnd.github.v3+json" /repos/{owner}/{repo}/git/refs/tags/latest-windows
# Create new pre-release
- name: Create Pre-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_RUN_NUMBER: ${{ github.run_number }}
run: |
gh release create latest-windows \
--prerelease \
--title "v${{ steps.project.outputs.version }} Pre-Release (${{ env.GITHUB_RUN_NUMBER }})" \
--notes "$(sed '/##/Q' CHANGELOG.md)"
# Only now download the artifacts so that there is a delay between creating the pre-release and adding the artifacts
- uses: actions/download-artifact@v3
with:
name: windows-installer
path: target
- uses: actions/download-artifact@v3
with:
name: linux-installer
path: target
# Upload artifact as a release asset
- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload latest-windows target/*
gh release edit latest-windows --draft=false