From 6267ecf2ce5d7c437b92e0972cd8352eb844abeb Mon Sep 17 00:00:00 2001 From: starsz Date: Sat, 28 Nov 2020 18:39:19 +0800 Subject: [PATCH] feat: add version into manager-pai (#866) --- api/VERSION | 1 + api/build.sh | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 api/VERSION diff --git a/api/VERSION b/api/VERSION new file mode 100644 index 0000000000..1f3e3c351b --- /dev/null +++ b/api/VERSION @@ -0,0 +1 @@ +v2.1-rc1 diff --git a/api/build.sh b/api/build.sh index 811eb84269..5bae5d28b3 100755 --- a/api/build.sh +++ b/api/build.sh @@ -19,6 +19,9 @@ set -ex export ENV=local pwd=`pwd` +VERSION=$(cat ./api/VERSION) +GIT_VERSION=$(git log -1 --pretty=format:%h) + rm -rf output && mkdir -p output/conf && mkdir -p output/dag-to-lua # get dag-to-lua lib @@ -29,7 +32,7 @@ if [[ ! -f "dag-to-lua-1.1/lib/dag-to-lua.lua" ]]; then fi # build -cd ./api && go build -o ../output/manager-api . && cd .. +cd ./api && go build -o ../output/manager-api -ldflags "-X main.Version=${VERSION}(${GIT_VERSION})" . && cd .. cp ./api/conf/schema.json ./output/conf/schema.json cp ./api/conf/conf.yaml ./output/conf/conf.yaml