Merge pull request #3886 from joostjager/release-checks

build: add version checks to release script
This commit is contained in:
Olaoluwa Osuntokun 2020-01-07 16:18:18 -08:00 committed by GitHub
commit 830d88a25c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,6 +16,35 @@ if [[ $1x = x ]]; then
TAG=$DATE-$VERSION TAG=$DATE-$VERSION
else else
TAG=$1 TAG=$1
# If a tag is specified, ensure that that tag is present and checked out.
if [[ $TAG != $(git tag -l --points-at HEAD) ]]; then
echo "tag $TAG not checked out"
exit 1
fi
# Build lnd to extract version.
go build github.com/lightningnetwork/lnd/cmd/lnd
# Extract version command output.
LND_VERSION_OUTPUT=`./lnd --version`
# Use a regex to isolate the version string.
LND_VERSION_REGEX="lnd version (.+) commit"
if [[ $LND_VERSION_OUTPUT =~ $LND_VERSION_REGEX ]]; then
# Prepend 'v' to match git tag naming scheme.
LND_VERSION="v${BASH_REMATCH[1]}"
echo "version: $LND_VERSION"
# Match git tag with lnd version.
if [[ $TAG != $LND_VERSION ]]; then
echo "lnd version $LND_VERSION does not match tag $TAG"
exit 1
fi
else
echo "malformed lnd version output"
exit 1
fi
fi fi
go mod vendor go mod vendor