Test and Compile #249
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: Test and Compile | |
on: | |
workflow_dispatch: | |
inputs: | |
dockerTag: | |
description: If set, docker img is built and tagged accordingly | |
required: false | |
push: | |
jobs: | |
Compile-and-Test: | |
name: Compile and Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Compile and test project | |
run: ./mvnw -B -U | |
--no-transfer-progress | |
compile test | |
- name: Show 3rd-Party Licenses | |
run: | | |
cat ./target/generated-sources/license/THIRD-PARTY.txt | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Test Results | |
path: "**/TEST-*.xml" | |
- name: Upload Licenses List | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Licenses List | |
path: "./target/generated-sources/license/THIRD-PARTY.txt" | |
Build-and-Deploy: | |
name: "Build and Push Docker Image" | |
runs-on: ubuntu-latest | |
if: github.ref_name == 'main' || github.event.inputs.dockerTag != '' | |
needs: | |
- Compile-and-Test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Build JIB container and publish to GitHub Packages | |
run: | |
TAG=${{github.event.inputs.dockerTag}} && | |
./mvnw -B -U | |
--no-transfer-progress | |
clean verify jib:build | |
-Drevision=${{github.run_number}} | |
-Dchangelist= | |
-Dsha1=.${GITHUB_SHA:0:7} | |
-Dquick | |
-Ddocker.namespace=${DOCKER_NAMESPACE,,} | |
-Djib.to.tags=${TAG:=latest} | |
-Djib.to.auth.username=${{ github.actor }} | |
-Djib.to.auth.password=${{ secrets.GITHUB_TOKEN }} | |
env: | |
DOCKER_NAMESPACE: ghcr.io/${{ github.repository_owner }} | |
event_file: | |
name: "Event File" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Event File | |
path: ${{ github.event_path }} |