File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 permissions :
1919 packages : write
2020 contents : read
21+ id-token : write
2122 steps :
2223 - name : Check out the repo
2324 uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
@@ -45,11 +46,37 @@ jobs:
4546 with :
4647 images : ghcr.io/${{ github.repository }}
4748
49+ - uses : sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
50+
4851 - name : Build and push Docker image
52+ id : build
4953 uses : docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a
5054 with :
5155 context : .
5256 platforms : linux/amd64,linux/arm64
5357 push : true
5458 tags : ${{ steps.meta.outputs.tags }}
5559 labels : ${{ steps.meta.outputs.labels }}
60+ provenance : mode=max
61+ sbom : true
62+
63+ - name : Sign image by digest
64+ env :
65+ DIGEST : ${{ steps.build.outputs.digest }}
66+ IMAGE : ghcr.io/${{ github.repository }}
67+ run : |
68+ set -euo pipefail
69+ [[ "$DIGEST" =~ ^sha256:[0-9a-f]{64}$ ]]
70+ cosign sign --yes "${IMAGE}@${DIGEST}"
71+
72+ - name : Verify remote provenance and SBOM attestations
73+ env :
74+ DIGEST : ${{ steps.build.outputs.digest }}
75+ IMAGE : ghcr.io/${{ github.repository }}
76+ run : |
77+ set -euo pipefail
78+ reference="${IMAGE}@${DIGEST}"
79+ docker buildx imagetools inspect "$reference" --format '{{ json .Provenance }}' \
80+ | jq -e 'type == "object" and length > 0' >/dev/null
81+ docker buildx imagetools inspect "$reference" --format '{{ json .SBOM }}' \
82+ | jq -e 'type == "object" and length > 0' >/dev/null
You can’t perform that action at this time.
0 commit comments