-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathbuild.sh
32 lines (28 loc) · 885 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
REPO=github.com/bnb-chain/greenfield-storage-provider
Version=`git describe --abbrev=0 --tags --always`
BranchName=`git rev-parse --abbrev-ref HEAD`
CommitID=`git rev-parse HEAD`
BuildTime=`date +%Y-%m-%d\ %H:%M`
CommitDate=`git log -n1 --pretty='format:%cd' --date=format:'%Y%m%d'`
if [ ! -d build ];then
mkdir -p build
mkdir -p build/data
fi
buf generate
go build -ldflags "\
-extldflags=${EXT_LD_FLAGS}
-X 'main.Version=${Version}' \
-X 'main.CommitID=${CommitID}' \
-X 'main.BranchName=${BranchName}' \
-X 'main.BuildTime=${BuildTime}' \
-X '${REPO}/store/bsdb.AppVersion=${Version}' \
-X '${REPO}/store/bsdb.GitCommit=${CommitID}' \
-X '${REPO}/store/bsdb.GitCommitDate=${CommitDate}'" \
-o ./build/gnfd-sp cmd/storage_provider/*.go
if [ $? -ne 0 ]; then
echo "build failed Ooooooh!!!"
exit 1
else
echo "build succeed!"
fi