From d84ca80c889ea544ccbab85a1d3a1d47fd3ec2d7 Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Thu, 4 May 2023 10:49:07 +0200 Subject: [PATCH] github/workflows: add the ability to push tags Signed-off-by: Rouven Czerwinski --- .github/workflows/docker.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 13ee64ee7..1a2e2dfbe 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,6 +3,8 @@ name: docker build on: push: branches: [ master ] + tags: + - '*' jobs: docker: @@ -24,10 +26,21 @@ jobs: docker-compose -f dockerfiles/staging/docker-compose.yml up --exit-code-from client client docker-compose -f dockerfiles/staging/docker-compose.yml down docker images + - name: Tag latest images + run: | docker tag labgrid-client ${{ secrets.DOCKERHUB_PREFIX }}client docker tag labgrid-exporter ${{ secrets.DOCKERHUB_PREFIX }}exporter docker tag labgrid-coordinator ${{ secrets.DOCKERHUB_PREFIX }}coordinator - docker push ${{ secrets.DOCKERHUB_PREFIX }}client - docker push ${{ secrets.DOCKERHUB_PREFIX }}exporter - docker push ${{ secrets.DOCKERHUB_PREFIX }}coordinator - docker images + - name: Tag release image + if: startsWith(github.ref, 'refs/tags') + run: | + docker tag labgrid-client ${{ secrets.DOCKERHUB_PREFIX }}client:${GITHUB_REF_NAME} + docker tag labgrid-exporter ${{ secrets.DOCKERHUB_PREFIX }}exporter:${GITHUB_REF_NAME} + docker tag labgrid-coordinator ${{ secrets.DOCKERHUB_PREFIX }}coordinator:${GITHUB_REF_NAME} + - name: Push to dockerhub + run: | + docker push --all-tags ${{ secrets.DOCKERHUB_PREFIX }}client + docker push --all-tags ${{ secrets.DOCKERHUB_PREFIX }}exporter + docker push --all-tags ${{ secrets.DOCKERHUB_PREFIX }}coordinator + - name: Show images again + run: docker images