Skip to content

Build

Build #313

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Build
on:
workflow_dispatch:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build-jar:
if: |
contains(github.event_name, 'workflow_dispatch') ||
contains(github.event.head_commit.message, '[trigger-nightly-build]')
runs-on: ubuntu-latest
permissions: write-all
outputs:
project-version: ${{ steps.bump-version.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Extract Maven project version
run: echo "version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT
id: bump-version
- name: Rename artifact to contain "nightly"
run: mv target/nqueensfaf-${{ steps.bump-version.outputs.version }}.jar target/nqueensfaf-${{ steps.bump-version.outputs.version }}-nightly.jar
- name: Upload artifact to nightly release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload nightly target/nqueensfaf-${{ steps.bump-version.outputs.version }}-nightly.jar --clobber
- name: Submit Dependency Snapshot
uses: advanced-security/maven-dependency-submission-action@v3
build-linux:
runs-on: ubuntu-latest
needs: build-jar
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Rename artifact to contain "nightly"
run: mv target/nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}-linux.zip target/nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}-nightly-linux.zip
- name: Upload artifact to nightly release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload nightly target/nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}-nightly-linux.zip --clobber
- name: Extract lwjgl native shared library
run: |
cd target
7z e nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}.jar linux/x64/org/lwjgl/liblwjgl.so
- name: Upload shared library
uses: actions/upload-artifact@v3
with:
name: lwjgl-linux-native
path: target/liblwjgl.so
retention-days: 1
build-macos:
runs-on: macos-latest
needs: build-jar
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Rename artifact to contain "nightly"
run: mv target/nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}-mac.zip target/nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}-nightly-mac.zip
- name: Upload artifact to nightly release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload nightly target/nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}-nightly-mac.zip --clobber
- name: Extract lwjgl native shared library
run: |
cd target
7z e nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}.jar macos/x64/org/lwjgl/liblwjgl.dylib
- name: Upload shared library
uses: actions/upload-artifact@v3
with:
name: lwjgl-macos-native
path: target/liblwjgl.dylib
retention-days: 1
build-windows:
runs-on: windows-latest
needs: build-jar
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Rename artifact to contain "nightly"
run: mv target/nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}-windows.zip target/nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}-nightly-windows.zip
- name: Upload artifact to nightly release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload nightly target/nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}-nightly-windows.zip --clobber
- name: Extract lwjgl native shared library
run: |
cd target
7z e nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}.jar windows/x64/org/lwjgl/lwjgl.dll
- name: Upload shared library
uses: actions/upload-artifact@v3
with:
name: lwjgl-windows-native
path: target/lwjgl.dll
retention-days: 1
build-jar-cli:
runs-on: ubuntu-latest
needs: [build-jar, build-linux, build-macos, build-windows]
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Download lwjgl natives
uses: actions/download-artifact@v3
- name: Inject lwjgl natives into runnable jar
run: |
mkdir -p target/macos/x64/org/lwjgl
mkdir -p target/windows/x64/org/lwjgl
mv lwjgl-macos-native/liblwjgl.dylib target/macos/x64/org/lwjgl
mv lwjgl-windows-native/lwjgl.dll target/windows/x64/org/lwjgl
cd target
7z a nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}.jar macos windows
- name: Rename artifact to contain "nightly"
run: mv target/nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}.jar target/nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}-nightly.jar
- name: Upload artifact to nightly release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload nightly target/nqueensfaf-cli-${{ needs.build-jar.outputs.project-version }}-nightly.jar --clobber
update-nightly-tag:
runs-on: ubuntu-latest
needs: [build-jar, build-jar-cli]
steps:
#- name: Delete release drafts
# uses: hugo19941994/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update nightly tag
uses: richardsimko/update-tag@v1
with:
tag_name: nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}