Via v5 #2901
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: Java CI with Gradle | |
on: [ push, pull_request ] | |
jobs: | |
build: | |
# Only run on PRs if the source branch is on someone else's repo | |
if: "${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Validate Gradle wrapper | |
uses: gradle/actions/wrapper-validation@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Execute Gradle build | |
run: ./gradlew build test --stacktrace | |
- name: Prepare Upload | |
run: | | |
projectVersion=$(grep '^maven_version=' gradle.properties | cut -d'=' -f2) | |
mkdir client/build/upload | |
cp client/build/libs/SoulFireClient-$projectVersion.jar client/build/upload | |
mkdir dedicated/build/upload | |
cp dedicated/build/libs/SoulFireDedicated-$projectVersion.jar dedicated/build/upload | |
- name: Upload client Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: SoulFireClient | |
if-no-files-found: error | |
path: | | |
client/build/upload/*.jar | |
- name: Upload dedicated Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: SoulFireDedicated | |
if-no-files-found: error | |
path: | | |
dedicated/build/upload/*.jar | |
jpackage-linux: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download a Build Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: SoulFireClient | |
path: build/libs | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Install rpm | |
run: sudo apt-get install rpm | |
- name: Package with jpackage | |
run: | | |
projectVersion=$(grep '^maven_version=' gradle.properties | cut -d'=' -f2) | |
projectVersionStripped=${projectVersion/-SNAPSHOT/} | |
echo "Building rpm package" | |
jpackage --app-version $projectVersionStripped --main-jar "SoulFireClient-$projectVersion.jar" "@installer/jpackage.cfg" "@installer/jpackage-linux.cfg" --type rpm | |
echo "Finished building rpm package" | |
echo "Building deb package" | |
jpackage --app-version $projectVersionStripped --main-jar "SoulFireClient-$projectVersion.jar" "@installer/jpackage.cfg" "@installer/jpackage-linux.cfg" --type deb | |
echo "Finished building deb package" | |
- name: Upload installer | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-installer | |
if-no-files-found: error | |
path: | | |
build/distributions/* | |
jpackage-windows: | |
needs: build | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download a Build Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: SoulFireClient | |
path: build/libs | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Package with jpackage | |
run: | | |
$projectVersion = Select-String -Path gradle.properties -Pattern '^maven_version=' | ForEach-Object { $_.ToString().Split('=')[1] } | |
$projectVersionStripped = $projectVersion -replace '-SNAPSHOT', '' | |
echo "Building exe package" | |
jpackage --app-version $projectVersionStripped --main-jar "SoulFireClient-$projectVersion.jar" "@installer/jpackage.cfg" "@installer/jpackage-windows.cfg" | |
echo "Finished building exe package" | |
- name: Upload installer | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-installer | |
if-no-files-found: error | |
path: | | |
build/distributions/* | |
jpackage-mac: | |
needs: build | |
runs-on: macos-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download a Build Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: SoulFireClient | |
path: build/libs | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Package with jpackage | |
run: | | |
projectVersion=$(grep '^maven_version=' gradle.properties | cut -d'=' -f2) | |
projectVersionStripped=${projectVersion/-SNAPSHOT/} | |
echo "Building dmg package" | |
jpackage --app-version $projectVersionStripped --main-jar "SoulFireClient-$projectVersion.jar" "@installer/jpackage.cfg" "@installer/jpackage-mac.cfg" | |
echo "Finished building dmg package" | |
- name: Upload installer | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mac-installer | |
if-no-files-found: error | |
path: | | |
build/distributions/* |