Skip to content

Commit 4b97974

Browse files
committed
Add release workflow (SBOM + Cosign)
- publish source code to GitHub releases with GoReleaser - publish SBOM in SPDX format with Syft - sign checksums with Cosign and GitHub OIDC Signed-off-by: Stefan Prodan <[email protected]>
1 parent f65bcb9 commit 4b97974

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

.github/workflows/release.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write # needed to write releases
10+
id-token: write # needed for keyless signing
11+
packages: write # needed for ghcr access
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-go@v2
21+
with:
22+
go-version: 1.17.x
23+
- uses: actions/cache@v2
24+
with:
25+
path: ~/go/pkg/mod
26+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
27+
restore-keys: |
28+
${{ runner.os }}-go-
29+
- uses: sigstore/cosign-installer@main
30+
- uses: anchore/sbom-action/download-syft@v0
31+
- uses: goreleaser/goreleaser-action@v2
32+
with:
33+
version: latest
34+
args: release --rm-dist
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
project_name: source-watcher
2+
3+
builds:
4+
skip: true
5+
6+
release:
7+
prerelease: auto
8+
9+
changelog:
10+
use: github-native
11+
12+
checksum:
13+
name_template: 'checksums.txt'
14+
15+
source:
16+
enabled: true
17+
18+
sboms:
19+
- artifacts: archive
20+
- id: source
21+
artifacts: source
22+
23+
# signs the checksum file
24+
# all files (including the sboms) are included in the checksum, so we don't need to sign each one if we don't want to
25+
# https://goreleaser.com/customization/sign
26+
signs:
27+
- cmd: cosign
28+
env:
29+
- COSIGN_EXPERIMENTAL=1
30+
certificate: '${artifact}.pem'
31+
args:
32+
- sign-blob
33+
- '--output-certificate=${certificate}'
34+
- '--output-signature=${signature}'
35+
- '${artifact}'
36+
artifacts: checksum
37+
output: true

0 commit comments

Comments
 (0)