Skip to content

Commit

Permalink
chore: sbom and build attestations #527 (#528)
Browse files Browse the repository at this point in the history
  • Loading branch information
srinandan authored Aug 28, 2024
1 parent db42098 commit a9e046f
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

runs-on: ubuntu-latest
permissions:
contents: read
contents: write # needed to publish sbom
packages: write
id-token: write
attestations: write
Expand Down Expand Up @@ -119,3 +119,31 @@ jobs:
TAGS: ${{ steps.meta.outputs.tags }}
run: |
cosign sign --yes ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}
- name: Generate SBOM
uses: anchore/sbom-action@v0
with:
format: 'spdx-json'
output-file: 'sbom.spdx.json'
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}

- name: Publish SBOM
uses: anchore/sbom-action/publish-sbom@v0
with:
sbom-artifact-match: ".*\\.spdx$"

- name: Attest build provenance
uses: actions/attest-build-provenance@v1
id: attest
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.build-and-push.outputs.digest }}
push-to-registry: true

- name: Attest SBOM
uses: actions/attest-sbom@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.build-and-push.outputs.digest }}
sbom-path: 'sbom.spdx.json'
push-to-registry: true

0 comments on commit a9e046f

Please sign in to comment.