storj/scripts/release.sh
Michal Niewrzal fdf40a7526 storj: remove storj/private/version package which was moved to
`storj/private` repo

Change-Id: I81c3f5b9d5e4fe7bca760999eb045ee9734e5e2e
2020-03-24 14:31:33 +00:00

35 lines
865 B
Bash
Executable File

#!/usr/bin/env bash
set -eu
set -o pipefail
echo -n "Build timestamp: "
TIMESTAMP=$(date +%s)
echo $TIMESTAMP
echo -n "Git commit: "
if [[ "$(git diff --stat)" != '' ]] || [[ -n "$(git status -s)" ]]; then
COMMIT=$(git rev-parse HEAD)-dirty
RELEASE=false
else
COMMIT=$(git rev-parse HEAD)
RELEASE=true
fi
echo $COMMIT
echo -n "Tagged version: "
if git describe --tags --exact-match --match "v[0-9]*.[0-9]*.[0-9]*"; then
VERSION=$(git describe --tags --exact-match --match "v[0-9]*.[0-9]*.[0-9]*")
echo $VERSION
else
VERSION=v0.0.0
RELEASE=false
fi
echo Running "go $@"
exec go "$1" -ldflags \
"-s -w -X storj.io/private/version.buildTimestamp=$TIMESTAMP
-X storj.io/private/version.buildCommitHash=$COMMIT
-X storj.io/private/version.buildVersion=$VERSION
-X storj.io/private/version.buildRelease=$RELEASE" "${@:2}"