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:
parent
cec95779ae
commit
bcaf1599d5
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@ before:
|
|||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
flags:
|
||||
- -trimpath
|
||||
ldflags:
|
||||
- -s -w -X main.version={{ .Version }}
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user