@@ -22,15 +22,19 @@ jobs:
2222 permissions :
2323 contents : read
2424 packages : write
25+ attestations : write
26+ id-token : write
2527
2628 steps :
2729 - name : Checkout repository
28- uses : actions/checkout@v4
30+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
31+ with :
32+ persist-credentials : false # do not keep the token around
2933
3034 # Uses the `docker/login-action` action to log in to the Container registry using
3135 # the account and password that will publish the packages.
3236 - name : Log in to the Container registry
33- uses : docker/login-action@v3
37+ uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
3438 with :
3539 registry : ${{ env.REGISTRY }}
3640 username : ${{ github.actor }}
4246 # The `images` value provides the base name for the tags and labels.
4347 - name : Extract metadata (tags, labels) for Docker
4448 id : meta
45- uses : docker/metadata-action@v5
49+ uses : docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
4650 with :
4751 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4852
@@ -53,11 +57,22 @@ jobs:
5357 # It uses the `tags` and `labels` parameters to tag and label the image with
5458 # the output from the "meta" step.
5559 - name : Build and push Docker image
56- uses : docker/build-push-action@v5
60+ id : push
61+ uses : docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
5762 with :
5863 context : .
5964 push : true
6065 tags : |
6166 ${{ steps.meta.outputs.tags }}
6267 ${{ env.REGISTRY }}/aboutcode-org/dejacode:latest
6368 labels : ${{ steps.meta.outputs.labels }}
69+
70+ # This step generates an artifact attestation for the image, which is an
71+ # unforgeable statement about where and how it was built.
72+ # It increases supply chain security for people who consume the image.
73+ - name : Generate artifact attestation
74+ uses : actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0
75+ with :
76+ subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
77+ subject-digest : ${{ steps.push.outputs.digest }}
78+ push-to-registry : true
0 commit comments