fix: Embed version in GoReleaser builds

- add trimpath and ldflags to inject main.version

- use go-version-file in release workflow

Signed-off-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
Rui Chen 2026-02-07 10:17:53 -05:00
parent cec95779ae
commit bcaf1599d5
No known key found for this signature in database
GPG Key ID: 6577287BDCA70840
2 changed files with 5 additions and 1 deletions

View File

@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
go-version-file: go.mod
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6

View File

@ -7,6 +7,10 @@ before:
builds:
- env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -s -w -X main.version={{ .Version }}
goos:
- linux
- windows