Skip to content

Commit 1ed4e71

Browse files
authored
feat: enhance Alauda release with version generation and build flags (#7)
Add version generation step to remove 'alauda-' prefix from tag names and configure ldflags for proper version embedding in binaries.
1 parent eb7c65f commit 1ed4e71

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.github/workflows/reusable-release-alauda.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,18 @@ jobs:
2424
go-version-file: go.mod
2525
cache: false
2626

27+
- name: Generate Version
28+
id: generate_version
29+
run: |
30+
# remove "alauda-" prefix
31+
GENERATED_VERSION=$(echo "${{ github.ref_name }}" | sed 's/alauda-//')
32+
echo "GENERATED_VERSION=$GENERATED_VERSION" >> $GITHUB_OUTPUT
33+
2734
- name: Set up GoReleaser
2835
uses: goreleaser/goreleaser-action@v6
2936
with:
3037
version: v2.1.0
3138
args: release -f=.goreleaser-alauda.yml
3239
env:
3340
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
GENERATED_VERSION: ${{ steps.generate_version.outputs.GENERATED_VERSION }}

.goreleaser-alauda.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ builds:
2222
goarch:
2323
- amd64
2424
- arm64
25-
ldflags:
26-
- -w -s -extldflags '-static'
25+
flags:
26+
- -trimpath
27+
ldflags: -s -w -X main.version={{.Env.GENERATED_VERSION}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
2728
main: ./cmd/golangci-lint/
2829
binary: alauda-golangci-lint
2930

0 commit comments

Comments
 (0)