Skip to content

Commit 2ec580c

Browse files
authored
Merge pull request #201 from joostjager/improve-release-script
release: add tag and version verification to release script
2 parents 9fba8eb + 6ac3d39 commit 2ec580c

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.DEFAULT_GOAL := build
2+
13
PKG := github.com/lightninglabs/loop
24

35
GOTEST := GO111MODULE=on go test -v

release.sh

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,54 @@
44
# we support with the golang cross-compiler.
55
#
66
# Copyright (c) 2016 Company 0, LLC.
7-
# Copyright (c) 2019 Lightning Labs
87
# Use of this source code is governed by the ISC
98
# license.
109

10+
# Exit on errors.
11+
set -e
12+
1113
# If no tag specified, use date + version otherwise use tag.
1214
if [[ $1x = x ]]; then
1315
DATE=`date +%Y%m%d`
1416
VERSION="01"
1517
TAG=$DATE-$VERSION
1618
else
1719
TAG=$1
20+
21+
# If a tag is specified, ensure that that tag is present and checked out.
22+
if [[ $TAG != $(git describe) ]]; then
23+
echo "tag $TAG not checked out"
24+
exit 1
25+
fi
26+
27+
# Verify that it is signed.
28+
if ! git verify-tag $TAG; then
29+
echo "tag $TAG not signed"
30+
exit 1
31+
fi
32+
33+
# Build loop to extract version.
34+
make
35+
36+
# Extract version command output.
37+
LOOP_VERSION_OUTPUT=`./loopd-debug --version`
38+
39+
# Use a regex to isolate the version string.
40+
LOOP_VERSION_REGEX="version (.+) "
41+
if [[ $LOOP_VERSION_OUTPUT =~ $LOOP_VERSION_REGEX ]]; then
42+
# Prepend 'v' to match git tag naming scheme.
43+
LOOP_VERSION="v${BASH_REMATCH[1]}"
44+
echo "version: $LOOP_VERSION"
45+
46+
# Match git tag with loop version.
47+
if [[ $TAG != $LOOP_VERSION ]]; then
48+
echo "loop version $LOOP_VERSION does not match tag $TAG"
49+
exit 1
50+
fi
51+
else
52+
echo "malformed loop version output"
53+
exit 1
54+
fi
1855
fi
1956

2057
go mod vendor

0 commit comments

Comments
 (0)