Skip to content

.github/workflows/release_workflow.yml #16

.github/workflows/release_workflow.yml

.github/workflows/release_workflow.yml #16

name: Publish
on:
workflow_dispatch:
inputs:
project-dir:
default: ''
required: true
description: 'was ist das projekt directory'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
publish-package:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
cache: "maven"
java-version: '17'
distribution: 'temurin'
- name: Publish package
run: mvn --batch-mode -f ${{ github.event.inputs.project-dir }}/pom.xml deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- 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
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: ./${{ github.event.inputs.project-dir }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}