diff --git a/hack/build b/hack/build index 7c23dc109f4..f8cac988984 100755 --- a/hack/build +++ b/hack/build @@ -6,6 +6,9 @@ set -e : "${PACKAGE=github.com/docker/buildx}" : "${VERSION=$(./hack/git-meta version)}" : "${REVISION=$(./hack/git-meta revision)}" +: "${PRERELEASE=$(./hack/git-meta version | rev | cut -c3- | rev | cut -d'-' -f 2 | grep -E '(^tp|^rc).*')}" +: "${REVISION_NUMBER=1}" +VERSION=$(printf "v%sm%s%s" "$(./hack/git-meta version | rev | cut -c3- | rev | cut -d'-' -f 1 | cut -c2-)" "${REVISION_NUMBER}" "-${PRERELEASE}") : "${CGO_ENABLED=0}" : "${GO_PKG=github.com/docker/buildx}" @@ -13,5 +16,6 @@ set -e : "${GO_LDFLAGS=-X ${GO_PKG}/version.Version=${VERSION} -X ${GO_PKG}/version.Revision=${REVISION} -X ${GO_PKG}/version.Package=${PACKAGE}}" : "${GO_EXTRA_LDFLAGS=}" + set -x CGO_ENABLED=$CGO_ENABLED go build -mod vendor -trimpath ${GO_EXTRA_FLAGS} -ldflags "${GO_LDFLAGS} ${GO_EXTRA_LDFLAGS}" -o "${DESTDIR}/docker-buildx" ./cmd/buildx