Publish Docker image for new tag/release #2
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: Publish Docker image for new tag/release | |
on: | |
push: | |
tags: | |
- '*' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
name: Publish Docker image for new tag/release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
java: [ 21 ] | |
dockerfile-path: [Dockerfile, Dockerfile-modules] | |
include: | |
- dockerfile-path: Dockerfile | |
build-cmd: mvn clean package -Dcheckstyle.skip -Dmaven.test.skip=true | |
package-name: ghcr.io/${{ github.repository }} | |
- dockerfile-path: Dockerfile-modules | |
build-cmd: mvn clean package --file extra/pom.xml -Dcheckstyle.skip -Dmaven.test.skip=true | |
package-name: ghcr.io/${{ github.repository }}-bundle | |
steps: | |
- name: Check out Repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
cache: 'maven' | |
java-version: ${{ matrix.java }} | |
- name: Build .jar via Maven | |
run: ${{ matrix.build-cmd }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker Image | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ matrix.package-name }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ${{ matrix.dockerfile-path }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |