Skip to content

Commit 431e5a4

Browse files
committed
feat: Sign Docker image on build action
1 parent c34f9c5 commit 431e5a4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
permissions:
2222
contents: read # required for actions/checkout
2323
packages: write # required for pushing to ghcr.io
24+
id-token: write # required for signing with cosign
2425
steps:
2526
- name: Check out the repo
2627
uses: actions/checkout@v4
@@ -38,11 +39,25 @@ jobs:
3839
username: ${{ github.actor }}
3940
password: ${{ secrets.GITHUB_TOKEN }}
4041

42+
- name: Install cosign
43+
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0
44+
with:
45+
cosign-release: 'v2.2.4'
46+
4147
- name: Build and push Docker image
48+
id: build-and-push
4249
uses: docker/build-push-action@v5
4350
with:
4451
context: .
4552
push: true
4653
tags: |
4754
ghcr.io/sysdiglabs/sysdig-mcp-server:latest
4855
ghcr.io/sysdiglabs/sysdig-mcp-server:v${{ steps.extract_version.outputs.VERSION }}
56+
57+
- name: Sign the published Docker image
58+
env:
59+
TAGS: |
60+
ghcr.io/sysdiglabs/sysdig-mcp-server:latest
61+
ghcr.io/sysdiglabs/sysdig-mcp-server:v${{ steps.extract_version.outputs.VERSION }}
62+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
63+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

0 commit comments

Comments
 (0)