Skip to content

Commit 23196e2

Browse files
committed
add build script for add version automaticly
1 parent a66b483 commit 23196e2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

build.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
set -x
4+
5+
VERSION=`git branch | grep '*' | awk '{print $2}'`
6+
if [[ $VERSION == "master" ]];
7+
then
8+
VERSION=`git describe --tags --abbrev=0`
9+
fi
10+
11+
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags="-X 'main.version=$VERSION'" -o bin/app

0 commit comments

Comments
 (0)