Skip to content

Commit 77b8d99

Browse files
authored
Enable sigstore/cosign for container images (mtougeron#62)
1 parent 42328c2 commit 77b8d99

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

.github/workflows/publish.yml

+19
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ jobs:
3030
if: github.event_name == 'push'
3131
# Ensure test job passes before pushing image.
3232
needs: test
33+
permissions:
34+
contents: read
35+
packages: write
36+
# This is used to complete the identity challenge
37+
# with sigstore/fulcio when running outside of PRs.
38+
id-token: write
39+
3340
steps:
3441
-
3542
name: Checkout
@@ -73,3 +80,15 @@ jobs:
7380
push: ${{ github.event_name != 'pull_request' }}
7481
tags: ${{ steps.docker_meta.outputs.tags }}
7582
labels: ${{ steps.docker_meta.outputs.labels }}
83+
84+
- uses: sigstore/cosign-installer@main
85+
86+
# This will only write to the public Rekor transparency log when the Docker
87+
# repository is public to avoid leaking data. https://github.com/sigstore/cosign
88+
- name: Sign the published Docker image
89+
if: ${{ github.event_name != 'pull_request' }}
90+
env:
91+
COSIGN_EXPERIMENTAL: "true"
92+
# This step uses the identity token to provision an ephemeral certificate
93+
# against the sigstore community Fulcio instance.
94+
run: cosign sign ${{ steps.docker_meta.outputs.tags }}@${{ steps.docker_build.outputs.digest }}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313

1414
# Dependency directories (remove the comment below to include it)
1515
# vendor/
16+
17+
cosign.*

0 commit comments

Comments
 (0)