release: update release script to compile commit hash into binary

This commit is contained in:
Olaoluwa Osuntokun 2018-05-29 16:24:39 -07:00
parent 31aa8553e7
commit 1d7ff42d2a
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -26,6 +26,7 @@ SYS="windows-386 windows-amd64 openbsd-386 openbsd-amd64 linux-386 linux-amd64 l
# Use the first element of $GOPATH in the case where GOPATH is a list
# (something that is totally allowed).
GPATH=$(echo $GOPATH | cut -f1 -d:)
COMMITFLAGS="-X main.Commit=$(git rev-parse HEAD)"
for i in $SYS; do
OS=$(echo $i | cut -f1 -d-)
@ -33,8 +34,8 @@ for i in $SYS; do
mkdir $PACKAGE-$i-$TAG
cd $PACKAGE-$i-$TAG
echo "Building:" $OS $ARCH
env GOOS=$OS GOARCH=$ARCH go build -v github.com/lightningnetwork/lnd
env GOOS=$OS GOARCH=$ARCH go build -v github.com/lightningnetwork/lnd/cmd/lncli
env GOOS=$OS GOARCH=$ARCH go build -v -ldflags "$COMMITFLAGS" github.com/lightningnetwork/lnd
env GOOS=$OS GOARCH=$ARCH go build -v -ldflags "$COMMITFLAGS" github.com/lightningnetwork/lnd/cmd/lncli
cd ..
if [[ $OS = "windows" ]]; then
zip -r $PACKAGE-$i-$TAG.zip $PACKAGE-$i-$TAG