Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ jobs:
permissions:
packages: write
contents: read
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false

- uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0

- name: Log in to the Container registry
uses: docker/login-action@06fb636fac595d6fb4b28a5dfcb21a6f5091859c
with:
Expand All @@ -37,10 +40,36 @@ jobs:
with:
images: ghcr.io/${{ github.repository }}

- uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2

- name: Build and push Docker image
id: build
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
provenance: mode=max
sbom: true

- name: Sign image by digest
env:
DIGEST: ${{ steps.build.outputs.digest }}
IMAGE: ghcr.io/${{ github.repository }}
run: |
set -euo pipefail
[[ "$DIGEST" =~ ^sha256:[0-9a-f]{64}$ ]]
cosign sign --yes "${IMAGE}@${DIGEST}"

- name: Verify remote provenance and SBOM attestations
env:
DIGEST: ${{ steps.build.outputs.digest }}
IMAGE: ghcr.io/${{ github.repository }}
run: |
set -euo pipefail
reference="${IMAGE}@${DIGEST}"
docker buildx imagetools inspect "$reference" --format '{{ json .Provenance }}' \
| jq -e 'type == "object" and length > 0' >/dev/null
docker buildx imagetools inspect "$reference" --format '{{ json .SBOM }}' \
| jq -e 'type == "object" and length > 0' >/dev/null