Skip to content

Commit 023fabe

Browse files
author
Datanoise
committed
inject version and commit via ldflags in CI builds
1 parent 70ca4b1 commit 023fabe

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ jobs:
3636
if [ "${{ matrix.goos }}" = "windows" ]; then
3737
EXT=".exe"
3838
fi
39-
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -o dist/tinyice-${{ matrix.goos }}-${{ matrix.goarch }}${EXT} main.go
39+
VERSION="${{ github.ref_name }}"
40+
COMMIT="$(git rev-parse HEAD)"
41+
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w -X main.Version=${VERSION} -X main.Commit=${COMMIT}" -o dist/tinyice-${{ matrix.goos }}-${{ matrix.goarch }}${EXT} main.go
4042
4143
4244
- name: Upload artifacts

0 commit comments

Comments
 (0)