diff --git a/.github/workflows/reusable-release-alauda.yaml b/.github/workflows/reusable-release-alauda.yaml index 5749df851d4c..76c361b021e1 100644 --- a/.github/workflows/reusable-release-alauda.yaml +++ b/.github/workflows/reusable-release-alauda.yaml @@ -24,6 +24,13 @@ jobs: go-version-file: go.mod cache: false + - name: Generate Version + id: generate_version + run: | + # remove "alauda-" prefix + GENERATED_VERSION=$(echo "${{ github.ref_name }}" | sed 's/alauda-//') + echo "GENERATED_VERSION=$GENERATED_VERSION" >> $GITHUB_OUTPUT + - name: Set up GoReleaser uses: goreleaser/goreleaser-action@v6 with: @@ -31,3 +38,4 @@ jobs: args: release -f=.goreleaser-alauda.yml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GENERATED_VERSION: ${{ steps.generate_version.outputs.GENERATED_VERSION }} diff --git a/.goreleaser-alauda.yml b/.goreleaser-alauda.yml index 914dbada5a71..4e3b6490b2a0 100644 --- a/.goreleaser-alauda.yml +++ b/.goreleaser-alauda.yml @@ -22,8 +22,9 @@ builds: goarch: - amd64 - arm64 - ldflags: - - -w -s -extldflags '-static' + flags: + - -trimpath + ldflags: -s -w -X main.version={{.Env.GENERATED_VERSION}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} main: ./cmd/golangci-lint/ binary: alauda-golangci-lint