Skip to content

Java CI

Java CI #42

Workflow file for this run

name: Java CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
publish:
if: ${{ github.event_name != 'pull_request' && github.ref_name == 'master' }}
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build Spring Boot Image
run: mvn -B spring-boot:build-image "-Dspring-boot.build-image.imageName=ghcr.io/${{ github.repository }}" --file pom.xml
- name: Get Maven project version
id: version
uses: jactions/[email protected]
- name: Add version tag
run: >-
docker tag ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}
- name: Docker Login
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker image
run: >-
docker push ghcr.io/${{ github.repository }}:latest &&
docker push ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}