From e99d5c0ab21fc9aaac2d2828be412a73930dc442 Mon Sep 17 00:00:00 2001 From: mikutas <23391543+mikutas@users.noreply.github.com> Date: Mon, 14 Nov 2022 13:20:05 +0900 Subject: [PATCH] Fix mis-versioning due to hardcoding cmd.Version --- .github/workflows/release.yml | 2 ++ cmd/version.go | 2 +- scripts/xcompile.sh | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4a07f8cd..afbc4ac6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,6 +45,8 @@ jobs: mkdir -p build cp yq.1 build/yq.1 ./scripts/xcompile.sh + env: + VERSION: ${{ steps.get_version.outputs.VERSION }} - name: Release uses: softprops/action-gh-release@v1 diff --git a/cmd/version.go b/cmd/version.go index f222e4cb..745640e3 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -11,7 +11,7 @@ var ( GitDescribe string // Version is main version number that is being run at the moment. - Version = "4.30.1" + Version = "" // VersionPrerelease is a pre-release marker for the version. If this is "" (empty string) // then it means that it is a final release. Otherwise, this is a pre-release diff --git a/scripts/xcompile.sh b/scripts/xcompile.sh index bf19cda1..c2daaba1 100755 --- a/scripts/xcompile.sh +++ b/scripts/xcompile.sh @@ -1,8 +1,8 @@ #!/bin/bash set -e # you may need to go install github.com/mitchellh/gox@v1.0.1 first - -CGO_ENABLED=0 gox -ldflags "${LDFLAGS}" -output="build/yq_{{.OS}}_{{.Arch}}" --osarch="darwin/amd64 darwin/arm64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm linux/arm64 linux/mips linux/mips64 linux/mips64le linux/mipsle linux/ppc64 linux/ppc64le linux/s390x netbsd/386 netbsd/amd64 netbsd/arm openbsd/386 openbsd/amd64 windows/386 windows/amd64" +echo $VERSION +CGO_ENABLED=0 gox -ldflags "${LDFLAGS} -X cmd.Version=${VERSION}" -output="build/yq_{{.OS}}_{{.Arch}}" --osarch="darwin/amd64 darwin/arm64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm linux/arm64 linux/mips linux/mips64 linux/mips64le linux/mipsle linux/ppc64 linux/ppc64le linux/s390x netbsd/386 netbsd/amd64 netbsd/arm openbsd/386 openbsd/amd64 windows/386 windows/amd64" cd build @@ -21,4 +21,4 @@ rhash -r -a . -o checksums rhash --list-hashes > checksums_hashes_order -cp ../scripts/extract-checksum.sh . \ No newline at end of file +cp ../scripts/extract-checksum.sh .