Files
databunker/build.sh
2024-05-08 12:44:07 +03:00

36 lines
614 B
Bash
Executable File

#!/bin/sh
set -x
VERSION=$(cat ./version.txt)
HASH=$(git rev-parse --short=12 HEAD)
TIMESTAMP=$(date +%Y%m%d%H%M%S) # Current timestamp
FULL_VERSION=$VERSION-$TIMESTAMP-$HASH
if [ -x "~/go/bin/packr" ]; then
echo "Found ~/go/bin/packr"
elif [ -x "packr" ]; then
echo "Fond packr"
else
go install github.com/gobuffalo/packr/packr@latest
fi
cd src
go get -d -v
if [ -x "~/go/bin/packr" ]; then
~/go/bin/packr
else
packr
fi
CGO_ENABLED=0 go build -v -ldflags="-s -w -X main.version=$FULL_VERSION" -o ../databunker
if [ -x "~/go/bin/packr" ]; then
~/go/bin/packr clean
else
packr clean
fi
cd ..