Skip to content

Commit 585580a

Browse files
jhrozekclaude
andauthored
Add GoReleaser configuration for release automation (#21)
* Add GoReleaser configuration for release automation Configure GoReleaser to build and release binaries for the registry server. The configuration specifies the correct main package location at ./cmd/thv-registry-api and sets up multi-platform builds for Linux, macOS, and Windows on amd64 and arm64 architectures. This fixes the release workflow failure where GoReleaser couldn't locate the main package because it was using default settings. The configuration includes: - Version/commit/builddate injection via ldflags - Cosign signing for release artifacts - SBOM generation for security compliance - Archive generation with platform-specific formats - Source code release 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Fix package path in ko config for container image builds Correct the ldflags package path from github.com/stacklok/toolhive to github.com/stacklok/toolhive-registry-server to ensure version metadata is properly injected into container images. This was caught during PR review when verifying that version/commit/builddate are passed to container image builds. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
1 parent e015f8e commit 585580a

File tree

2 files changed

+64
-4
lines changed

2 files changed

+64
-4
lines changed

.github/ko-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ builds:
33
dir: ./cmd/thv-registry-api
44
ldflags:
55
- -s -w
6-
- -X github.com/stacklok/toolhive/pkg/versions.Version={{.Env.VERSION}}
7-
- -X github.com/stacklok/toolhive/pkg/versions.Commit={{.Env.COMMIT}}
8-
- -X github.com/stacklok/toolhive/pkg/versions.BuildDate={{.Env.BUILD_DATE}}
9-
- -X github.com/stacklok/toolhive/pkg/versions.BuildType=release
6+
- -X github.com/stacklok/toolhive-registry-server/pkg/versions.Version={{.Env.VERSION}}
7+
- -X github.com/stacklok/toolhive-registry-server/pkg/versions.Commit={{.Env.COMMIT}}
8+
- -X github.com/stacklok/toolhive-registry-server/pkg/versions.BuildDate={{.Env.BUILD_DATE}}
9+
- -X github.com/stacklok/toolhive-registry-server/pkg/versions.BuildType=release

.goreleaser.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
2+
project_name: toolhive-registry-server
3+
version: 2
4+
# This section defines the build matrix.
5+
builds:
6+
- env:
7+
- GO111MODULE=on
8+
- CGO_ENABLED=0
9+
flags:
10+
- -trimpath
11+
- -tags=netgo
12+
ldflags:
13+
- "-s -w"
14+
- "-X github.com/stacklok/toolhive-registry-server/pkg/versions.Version={{ .Env.VERSION }}"
15+
- "-X github.com/stacklok/toolhive-registry-server/pkg/versions.Commit={{ .Env.COMMIT }}"
16+
- "-X github.com/stacklok/toolhive-registry-server/pkg/versions.BuildDate={{ .Date }}"
17+
- "-X github.com/stacklok/toolhive-registry-server/pkg/versions.BuildType=release"
18+
goos:
19+
- linux
20+
- windows
21+
- darwin
22+
goarch:
23+
- amd64
24+
- arm64
25+
main: ./cmd/thv-registry-api
26+
binary: thv-registry-api
27+
# This section defines the release format.
28+
archives:
29+
- formats: [ 'tar.gz' ]
30+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
31+
format_overrides:
32+
- goos: windows
33+
formats: [ 'zip' ]
34+
# This section defines whether we want to release the source code too.
35+
source:
36+
enabled: true
37+
# This section defines how to generate the changelog
38+
changelog:
39+
sort: asc
40+
use: github
41+
# This section defines for which artifact types to generate SBOMs.
42+
sboms:
43+
- artifacts: archive
44+
# This section defines the release policy.
45+
release:
46+
github:
47+
owner: stacklok
48+
name: toolhive-registry-server
49+
# This section defines how and which artifacts we want to sign for the release.
50+
signs:
51+
- cmd: cosign
52+
args:
53+
- "sign-blob"
54+
- "--output-signature=${signature}"
55+
- "--output-certificate=${certificate}"
56+
- "${artifact}"
57+
- "--yes" # needed on cosign 2.0.0+
58+
artifacts: archive
59+
output: true
60+
certificate: '{{ trimsuffix (trimsuffix .Env.artifact ".zip") ".tar.gz" }}.pem'

0 commit comments

Comments
 (0)