This commit is contained in:
Riccardo Balbo
2025-06-08 20:09:51 +02:00
commit 305398fbe4
29 changed files with 6669 additions and 0 deletions

146
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,146 @@
name: Build and Package
on:
push:
pull_request:
release:
types: [created]
workflow_dispatch:
jobs:
build-jar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: gradle
- name: Build with Gradle
run: ./gradlew build
- name: Upload Fat JAR
uses: actions/upload-artifact@v4
with:
name: artifacts-portable
path: dist/portable/*-portable.jar
retention-days: 7
build-native:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
platform: linux
- os: windows-latest
platform: windows
- os: macos-latest
platform: macos
steps:
- uses: actions/checkout@v3
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Build Installer for ${{ matrix.platform }}
shell: bash
run: |
if [[ "${{ matrix.platform }}" == "linux" ]]; then
sudo apt-get install -y rpm
fi
./gradlew buildInstaller
ls -R dist
- name: Build Native Executable for ${{ matrix.platform }}
shell: bash
run: |
./gradlew buildNativeExecutable
ls -R dist
- name: Prepare artifacts for ${{ matrix.platform }}
shell: bash
run: |
if [[ "${{ matrix.platform }}" == "windows" ]]; then
choco install -y zip
fi
echo "Listing build artifacts for ${{ matrix.platform }}"
ls -R dist
mkdir -p dist/artifacts
artifactsDir="$PWD/dist/artifacts/"
cd dist
for platformDir in *.buildNative *.setup; do
if [ -d "$platformDir" ]; then
platform=${platformDir%.*}
cd "$platformDir"
if [[ "${{ matrix.platform }}" == "macos" ]]; then
ditto -c -k --sequesterRsrc --keepParent . "$artifactsDir/$platform.zip"
else
zip -r "$artifactsDir/$platform.zip" *
fi
cd ..
fi
done
ls -R
- name: Upload Artifacts for ${{ matrix.platform }}
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.platform }}
path: dist/artifacts/*
retention-days: 7
publish-release:
needs: [build-jar, build-native]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Rename and prepare artifacts
run: |
mkdir -p release
ls -R artifacts
releaseDir="$PWD/release"
for artifactDir in artifacts/artifacts-*; do
baseDir="$PWD"
cd "$artifactDir"
for artifact in *; do
cp "$artifact" "$releaseDir/"
done
cd "$baseDir"
done
- name: Upload release artifact to github actions
uses: actions/upload-artifact@v4
with:
name: release
path: release/*
retention-days: 60
- name: Upload Release to GitHub
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}