diff --git a/build/release/release.sh b/build/release/release.sh index bf78cb3e..8bb5c1e4 100755 --- a/build/release/release.sh +++ b/build/release/release.sh @@ -16,6 +16,35 @@ if [[ $1x = x ]]; then TAG=$DATE-$VERSION else 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 go mod vendor