Skip to content

Commit

Permalink
add semver tag and rebuild on dockerfile change
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielcjr committed Oct 6, 2023
1 parent d681020 commit 416cbd0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand Down

0 comments on commit 416cbd0

Please sign in to comment.