From 4247ee7d3707c8342bea8c6fb258f28ce1fa618c Mon Sep 17 00:00:00 2001 From: Mattijs Korpershoek Date: Wed, 21 Feb 2024 18:26:31 +0100 Subject: [PATCH] .github: actions: add docker-publish-release This is based of [1] and will be used to publish tagged releases with a different label to docker hub. [1] https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-docker-hub Signed-off-by: Mattijs Korpershoek --- .github/workflows/docker-publish-release.yml | 33 ++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/docker-publish-release.yml diff --git a/.github/workflows/docker-publish-release.yml b/.github/workflows/docker-publish-release.yml new file mode 100644 index 0000000..8a2a958 --- /dev/null +++ b/.github/workflows/docker-publish-release.yml @@ -0,0 +1,33 @@ +name: Publish Docker image release + +on: + release: + types: [published] + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: mkorpershoek/repo-resource + + - name: Build and push Docker image + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}