From 3ab39241754499be7a2288072518efe63a159efb Mon Sep 17 00:00:00 2001 From: Andrea Ceccanti Date: Wed, 12 May 2021 17:06:57 +0200 Subject: [PATCH] Proper docker image tagging --- .github/workflows/build-docker-image.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 276ed94..1f27fc6 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -12,22 +12,33 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v2 + with: + images: indigoiam/voms-importer + tags: | + type=sha + type=semver,pattern={{raw}} + type=ref,event=branch + - name: Copy script to docker dir run: cp vomsimporter.py docker - name: Build Docker image uses: docker/build-push-action@v2 with: - tags: indigoiam/voms-importer:latest + tags: ${{ steps.docker_meta.outputs.tags }} context: ./docker file: ./docker/Dockerfile - push: false - - - name: Push docker image - run: docker push indigoiam/voms-importer:latest + labels: ${{ steps.docker_meta.outputs.labels }} + push: ${{ startsWith(github.ref, 'refs/tags/') }}