add publish workflow
All checks were successful
Publish Docker image / Push Docker image to Docker Hub (release) Successful in 1h6m25s

This commit is contained in:
Justus Kuhlmann 2025-05-28 11:43:45 +02:00
parent 8ff4aaa7c7
commit e80aa47915

View file

@ -0,0 +1,47 @@
name: Publish Docker image
env:
DOCKER_USERNAME: jkuhl
DOCKER_LATEST: latest
IMAGE_NAME: jkuhl/hadrons-env
REGISTRY: kuhl-mann.de
on:
release:
types: [published]
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: https://github.com/RouxAntoine/checkout@v4.1.8
- name: Log in to Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PW }}
- name: Get Meta
id: meta
run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: | # replace it with your local IP and tags
kuhl-mann.de/${{ env.DOCKER_USERNAME }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
kuhl-mann.de/${{ env.DOCKER_USERNAME }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}