Merge pull request #201 from joostjager/improve-release-script

release: add tag and version verification to release script
pull/204/head
Joost Jager 4 years ago committed by GitHub
commit 2ec580c92b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,3 +1,5 @@
.DEFAULT_GOAL := build
PKG := github.com/lightninglabs/loop
GOTEST := GO111MODULE=on go test -v

@ -4,10 +4,12 @@
# we support with the golang cross-compiler.
#
# Copyright (c) 2016 Company 0, LLC.
# Copyright (c) 2019 Lightning Labs
# Use of this source code is governed by the ISC
# license.
# Exit on errors.
set -e
# If no tag specified, use date + version otherwise use tag.
if [[ $1x = x ]]; then
DATE=`date +%Y%m%d`
@ -15,6 +17,41 @@ 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 describe) ]]; then
echo "tag $TAG not checked out"
exit 1
fi
# Verify that it is signed.
if ! git verify-tag $TAG; then
echo "tag $TAG not signed"
exit 1
fi
# Build loop to extract version.
make
# Extract version command output.
LOOP_VERSION_OUTPUT=`./loopd-debug --version`
# Use a regex to isolate the version string.
LOOP_VERSION_REGEX="version (.+) "
if [[ $LOOP_VERSION_OUTPUT =~ $LOOP_VERSION_REGEX ]]; then
# Prepend 'v' to match git tag naming scheme.
LOOP_VERSION="v${BASH_REMATCH[1]}"
echo "version: $LOOP_VERSION"
# Match git tag with loop version.
if [[ $TAG != $LOOP_VERSION ]]; then
echo "loop version $LOOP_VERSION does not match tag $TAG"
exit 1
fi
else
echo "malformed loop version output"
exit 1
fi
fi
go mod vendor

Loading…
Cancel
Save