@@ -37,23 +37,21 @@ jobs:
3737 - name : Checkout repository
3838 uses : actions/checkout@v3
3939
40- # Install the cosign tool except on PR
40+ # Install the cosign tool
4141 # https://github.com/sigstore/cosign-installer
4242 - name : Install cosign
43- if : github.event_name != 'pull_request'
44- uses : sigstore/cosign-installer@v3.3.0
43+ uses : sigstore/cosign-installer@v3
4544
4645 # Set up BuildKit Docker container builder to be able to build
4746 # multi-platform images and export cache
4847 # https://github.com/docker/setup-buildx-action
4948 - name : Set up Docker Buildx
50- uses : docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
49+ uses : docker/setup-buildx-action@v3
5150
52- # Login against a Docker registry except on PR
51+ # Login against a Docker registry
5352 # https://github.com/docker/login-action
5453 - name : Log into registry ${{ env.REGISTRY }}
55- if : github.event_name != 'pull_request'
56- uses : docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
54+ uses : docker/login-action@v3
5755 with :
5856 registry : ${{ env.REGISTRY }}
5957 username : ${{ github.actor }}
@@ -63,31 +61,32 @@ jobs:
6361 # https://github.com/docker/metadata-action
6462 - name : Extract Docker metadata
6563 id : meta
66- uses : docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
64+ uses : docker/metadata-action@v5
6765 with :
6866 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
67+ tags : |
68+ ${{ github.event_name == 'pull_request' && 'pr-${{ github.event.pull_request.number }}' || steps.meta.outputs.tags }}
6969
70- # Build and push Docker image with Buildx (don't push on PR)
70+ # Build and push Docker image with Buildx
7171 # https://github.com/docker/build-push-action
7272 - name : Build and push Docker image
7373 id : build-and-push
74- uses : docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
74+ uses : docker/build-push-action@v5
7575 with :
7676 context : .
7777 platforms : linux/amd64,linux/arm64
78- push : ${{ github.event_name != 'pull_request' }}
78+ push : true
7979 tags : ${{ steps.meta.outputs.tags }}
8080 labels : ${{ steps.meta.outputs.labels }}
8181 cache-from : type=gha
8282 cache-to : type=gha,mode=max
8383
84- # Sign the resulting Docker image digest except on PRs .
84+ # Sign the resulting Docker image digest.
8585 # This will only write to the public Rekor transparency log when the Docker
8686 # repository is public to avoid leaking data. If you would like to publish
8787 # transparency data even for private images, pass --force to cosign below.
8888 # https://github.com/sigstore/cosign
8989 - name : Sign the published Docker image
90- if : ${{ github.event_name != 'pull_request' }}
9190 env :
9291 # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
9392 TAGS : ${{ steps.meta.outputs.tags }}
0 commit comments