diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 92cb632..e4fb926 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,10 +18,14 @@ jobs: uses: actions/setup-go@v5 with: go-version: "1.22.4" + - name: Get latest Git tag + run: + VERSION=$(git describe --tags --abbrev=0) + echo "VERSION=$VERSION" >> $GITHUB_ENV - name: Build run: | mkdir dist - env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} make build + env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w X 'github.com/rjuer/cidr/cmd.version=$(VERSION)'" -o dist/ - name: Test run: | mkdir tmp diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7237914..760eb62 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,10 +14,14 @@ jobs: uses: actions/setup-go@v5 with: go-version: "1.22.4" + - name: Get latest Git tag + run: + VERSION=$(git describe --tags --abbrev=0) + echo "VERSION=$VERSION" >> $GITHUB_ENV - name: Build run: | mkdir dist - make build + env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w X 'github.com/rjuer/cidr/cmd.version=$(VERSION)'" -o dist/ - name: Test run: | mkdir tmp