Skip to content

Commit

Permalink
sign release artifacts using cosign
Browse files Browse the repository at this point in the history
Signed-off-by: Prashant Rewar <[email protected]>
  • Loading branch information
prashantrewar committed Jan 9, 2024
1 parent 359d310 commit a762b8a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
# Set permissions of github token. See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -21,6 +22,10 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: 1.21.3

- name: Set up Cosign
uses: sigstore/cosign-installer@v3

- name: Retrieve version
run: |
echo "TAG_NAME=$(echo ${{ github.ref }} | grep -Eo 'v[0-9].*')" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -89,6 +94,14 @@ jobs:
${checksums['kbld-linux-arm64']} ./kbld-linux-arm64
${checksums['kbld-windows-amd64.exe']} ./kbld-windows-amd64.exe
${checksums['kbld-windows-arm64.exe']} ./kbld-windows-arm64.exe`
- name: Verify checksums signature
run: |
cosign verify-blob \
--cert dist/checksums.txt.pem \
--signature dist/checksums.txt.sig \
--certificate-identity-regexp=https://github.com/${{ github.repository_owner }} \
--certificate-oidc-issuer=https://token.actions.githubusercontent.com ./dist/checksums.txt
- name: verify uploaded artifacts
if: startsWith(github.ref, 'refs/tags/')
Expand Down
11 changes: 11 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ checksum:
name_template: 'checksums.txt'
algorithm: sha256
disable: false
signs:
- artifacts: checksum
certificate: '${artifact}.pem'
cmd: cosign
args:
- sign-blob
- "--yes"
- '--output-certificate=${certificate}'
- '--output-signature=${signature}'
- '${artifact}'
output: true
snapshot:
name_template: "{{ .Tag }}-next"
release:
Expand Down

0 comments on commit a762b8a

Please sign in to comment.