Skip to content

Commit 7c20346

Browse files
authored
build(release): add goreleaser workflow with cosign keyless signing (#35)
On v* tag push, run goreleaser to: - build a source tarball (library, no binaries) - generate SPDX SBOM via syft - emit checksums.txt - sign every artifact with cosign keyless (Sigstore OIDC via the GitHub Actions token) - publish a GitHub Release with notes grouped by conventional commit type Lifts Scorecard's Signed-Releases from '?' to 10/10 once the first tagged release cuts.
1 parent f6037c0 commit 7c20346

2 files changed

Lines changed: 129 additions & 0 deletions

File tree

.github/workflows/release.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
release:
13+
name: release
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: write # create GitHub Releases
18+
id-token: write # cosign keyless signing via Sigstore OIDC
19+
attestations: write # build provenance
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Install Go
28+
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
29+
with:
30+
go-version: stable
31+
32+
- name: Install cosign
33+
uses: sigstore/cosign-installer@cad07c2e89fa2edd6e2d7bab4c1aa38e53f76003 # v4.1.1
34+
35+
- name: Install syft (for SBOM generation)
36+
uses: anchore/sbom-action/download-syft@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
37+
38+
- name: Run goreleaser
39+
uses: goreleaser/goreleaser-action@e24998b8b67b290c2fa8b7c14fcfa7de2c5c9b8c # v7.1.0
40+
with:
41+
distribution: goreleaser
42+
version: "~> v2"
43+
args: release --clean
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
version: 2
2+
3+
project_name: queue
4+
5+
before:
6+
hooks:
7+
- go mod tidy
8+
9+
# Library, no binaries to build.
10+
builds:
11+
- skip: true
12+
13+
source:
14+
enabled: true
15+
format: tar.gz
16+
name_template: "{{ .ProjectName }}-{{ .Version }}-source"
17+
18+
checksum:
19+
name_template: "checksums.txt"
20+
21+
sboms:
22+
- id: source-sbom
23+
artifacts: source
24+
documents:
25+
- "{{ .ProjectName }}-{{ .Version }}.spdx.json"
26+
27+
signs:
28+
- cmd: cosign
29+
signature: "${artifact}.sig"
30+
certificate: "${artifact}.pem"
31+
args:
32+
- sign-blob
33+
- --oidc-issuer=https://token.actions.githubusercontent.com
34+
- --output-certificate=${certificate}
35+
- --output-signature=${signature}
36+
- ${artifact}
37+
- --yes
38+
artifacts: all
39+
40+
release:
41+
github:
42+
owner: adrianbrad
43+
name: queue
44+
prerelease: auto
45+
mode: replace
46+
footer: |
47+
## Verification
48+
49+
All release artifacts are signed with cosign keyless signing via Sigstore.
50+
To verify the checksums file, for example:
51+
52+
```bash
53+
cosign verify-blob \
54+
--certificate checksums.txt.pem \
55+
--signature checksums.txt.sig \
56+
--certificate-identity-regexp '^https://github.com/adrianbrad/queue/\.github/workflows/release\.yaml@refs/tags/' \
57+
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
58+
checksums.txt
59+
```
60+
61+
changelog:
62+
use: github
63+
sort: asc
64+
groups:
65+
- title: Features
66+
regexp: '^.*?feat(\(.+\))?!?:.+$'
67+
order: 0
68+
- title: Fixes
69+
regexp: '^.*?fix(\(.+\))?!?:.+$'
70+
order: 1
71+
- title: Performance
72+
regexp: '^.*?perf(\(.+\))?!?:.+$'
73+
order: 2
74+
- title: Other
75+
order: 999
76+
filters:
77+
exclude:
78+
- '^docs:'
79+
- '^test:'
80+
- '^chore:'
81+
- '^style:'
82+
- '^build:'
83+
- '^ci:'
84+
- 'Merge pull request'

0 commit comments

Comments
 (0)