Skip to content

.github/workflows/build.yml #119

.github/workflows/build.yml

.github/workflows/build.yml #119

Workflow file for this run

on:
push:
branches: [ main ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 20 * * 5'
jobs:
check-code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
- name: Check Pom Sort
run: mvn -B sortpom:verify
- name: Check File Formatting
run: mvn -B fmt:check
run-code-tests:
needs: check-code-quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
- name: Test Code
run: mvn -B verify
deploy-artifact:
needs: [check-code-quality, run-code-tests]
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
name: Build and Deploy Image
run: mvn -B clean install jib:build
- if: ${{ startsWith(github.ref, 'refs/tags/v') }}
name: Build and Deploy Tag Image
run: mvn -B clean install jib:build -P release