From e80aa47915512eac04150d221aef281d9b1dc356 Mon Sep 17 00:00:00 2001 From: Justus Kuhlmann Date: Wed, 28 May 2025 11:43:45 +0200 Subject: [PATCH] add publish workflow --- .gitea/workflows/docker-publish.yml | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .gitea/workflows/docker-publish.yml diff --git a/.gitea/workflows/docker-publish.yml b/.gitea/workflows/docker-publish.yml new file mode 100644 index 0000000..7778614 --- /dev/null +++ b/.gitea/workflows/docker-publish.yml @@ -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 }}