From 416cbd0dfb99c2da6083f30c18593827b4d387ba Mon Sep 17 00:00:00 2001 From: Gabriel Carneiro Jr Date: Fri, 6 Oct 2023 15:27:38 -0300 Subject: [PATCH] add semver tag and rebuild on dockerfile change --- .github/workflows/docker-publish.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 0eac19b..9ab811e 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -64,10 +64,13 @@ jobs: uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: + type=semver,pattern={{version}},value=v1.0.0 # Build and push Docker image with Buildx (don't push on PR) # https://github.com/docker/build-push-action - name: Build and push Docker image + if: ${{ github.event_name != 'pull_request' && contains(github.event.head_commit, 'Dockerfile')}} id: build-and-push uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 with: @@ -84,7 +87,7 @@ jobs: # transparency data even for private images, pass --force to cosign below. # https://github.com/sigstore/cosign - name: Sign the published Docker image - if: ${{ github.event_name != 'pull_request' }} + if: ${{ github.event_name != 'pull_request' && contains(github.event.head_commit, 'Dockerfile')}} env: # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable TAGS: ${{ steps.meta.outputs.tags }}