Skip to content

Commit 3ebdbbf

Browse files
committed
Add sigstore
1 parent 7b6f766 commit 3ebdbbf

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

.github/workflows/docker-build-push.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ on:
88
- cron: "0 0 * * 0"
99
workflow_dispatch:
1010

11-
permissions: {}
11+
permissions:
12+
# Required by sigstore
13+
id-token: write
1214

1315
jobs:
1416
build:
@@ -48,3 +50,18 @@ jobs:
4850
sbom: true
4951
tags: ${{ steps.meta.outputs.tags }}
5052
labels: ${{ steps.meta.outputs.labels }}
53+
- name: Install cosign
54+
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
55+
- name: Sign the Docker image
56+
working-directory: ${{ env.IMAGE }}
57+
env:
58+
DIGEST: ${{ steps.build.outputs.digest }}
59+
TAGS: ${{ steps.meta.outputs.tags }}
60+
shell: bash
61+
run: |
62+
images=""
63+
for tag in ${TAGS}; do
64+
images+="${tag}@${DIGEST} "
65+
done
66+
# shellcheck disable=SC2086
67+
cosign sign --recursive --yes ${images}

.github/workflows/docker-release.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ on:
55
release:
66
types: [published]
77

8-
permissions: {}
8+
permissions:
9+
# Required by sigstore
10+
id-token: write
911

1012
jobs:
1113
release:
@@ -43,3 +45,18 @@ jobs:
4345
sbom: true
4446
tags: ${{ steps.meta.outputs.tags }}
4547
labels: ${{ steps.meta.outputs.labels }}
48+
- name: Install cosign
49+
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
50+
- name: Sign the Docker image
51+
working-directory: ${{ env.IMAGE }}
52+
env:
53+
DIGEST: ${{ steps.build.outputs.digest }}
54+
TAGS: ${{ steps.meta.outputs.tags }}
55+
shell: bash
56+
run: |
57+
images=""
58+
for tag in ${TAGS}; do
59+
images+="${tag}@${DIGEST} "
60+
done
61+
# shellcheck disable=SC2086
62+
cosign sign --recursive --yes ${images}

0 commit comments

Comments
 (0)