From e2add01d49f62e1b5b9f20bb462a685ce07310d3 Mon Sep 17 00:00:00 2001 From: Seunghyun Hwang Date: Mon, 25 Nov 2024 19:00:49 +0900 Subject: [PATCH] add version to release binary --- Dockerfile | 2 +- cmd/version.go | 2 +- scripts/gen-version-file.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9fd86ee..e14b650 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ RUN --mount=type=secret,id=github_token,env=GH_TOKEN \ && curl -sSL "https://github.com/cli/cli/releases/download/v2.62.0/gh_2.62.0_linux_$TARGETARCH.tar.gz" -o ./gh.tar.gz \ && tar -xf ./gh.tar.gz \ && mv ./gh_*/bin/gh ./gh \ - && BRING_NAME="./bring-linux-$TARGETARCH" \ + && BRING_NAME="./bring-$VERSION_NAME-linux-$TARGETARCH" \ && cp ./bring "$BRING_NAME" \ && ./gh version \ && ./gh auth status \ diff --git a/cmd/version.go b/cmd/version.go index 2da77b1..61822ff 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -32,7 +32,7 @@ func NewCmdVersion() *cli.Command { b := strings.Builder{} b.WriteString(fmt.Sprintf("BRING_VERSION=%s\n", _buildInfo.Version)) b.WriteString(fmt.Sprintf("BRING_TIME_BUILD=%s\n", _buildInfo.TimeBuild)) - b.WriteString(fmt.Sprintf("BUILD_GIT_REV=%s", _buildInfo.GitRev)) + b.WriteString(fmt.Sprintf("BRING_GIT_REV=%s", _buildInfo.GitRev)) if _buildInfo.GitDirty { b.WriteString("-dirty") } diff --git a/scripts/gen-version-file.sh b/scripts/gen-version-file.sh index af7b0db..09fa8c9 100755 --- a/scripts/gen-version-file.sh +++ b/scripts/gen-version-file.sh @@ -9,7 +9,7 @@ __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Directory where this scr __root="$(cd "$(dirname "${__dir}")" && pwd)" # Root directory of project. BRING_VERSION=${BRING_VERSION:-"v0.0.0-test"} -TIME_BUILD=$(date --rfc-3339=seconds) +TIME_BUILD=$(date -u "+%Y-%m-%dT%H:%M:%SZ") GIT_REV=$(git rev-parse HEAD) GIT_DIRTY=$(git status --porcelain | read -t 0 && echo "true" || echo "false")