Updated dina-base #109
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 | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
cache: 'maven' | |
- name: Build with Maven | |
run: mvn -B -q verify | |
- name: Run Checkstyle | |
run: mvn -q checkstyle:check | |
- name: Run SpotBugs | |
run: mvn -q spotbugs:check | |
- name: Run OWASP dependency-check (only on dev) | |
run: mvn -q org.owasp:dependency-check-maven:check | |
if: ${{ github.ref == 'refs/heads/dev' }} | |
- name: Set up for Maven Central deploy (master branch only) | |
uses: actions/setup-java@v3 | |
if: ${{ github.ref == 'refs/heads/master-SKIP' }} | |
with: # update default settings.xml | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'maven' | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_CENTRAL_PW | |
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Publish to Maven Central (master branch only) | |
if: ${{ github.ref == 'refs/heads/master-SKIP' }} | |
run: mvn -DsignArtifacts=true --batch-mode javadoc:jar source:jar deploy | |
env: | |
MAVEN_USERNAME: aafcbicoe | |
MAVEN_CENTRAL_PW: ${{ secrets.MAVEN_CENTRAL_PW }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
- name: Extract Version | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: | | |
mvn help:evaluate -Dexpression=project.version -q -DforceStdout > version.txt | |
- name: Store artifacts | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-artifacts | |
path: | | |
version.txt | |
target/agent-api-*.jar | |
Dockerfile | |
!target/agent-api-*sources.jar | |
!target/agent-api-*javadoc.jar | |
push: | |
name: Build Docker Image and Push to DockerHub | |
needs: [build] | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/master' }} | |
steps: | |
- name: Download artifacts from build job | |
uses: actions/download-artifact@v2 | |
with: | |
name: build-artifacts | |
- name: Set VERSION_TAG ENV variable | |
run: | | |
echo "VERSION_TAG=$(cat version.txt)" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Image and Push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
tags: aafcbicoe/agent-api:${{ env.VERSION_TAG }} | |
provenance: false |