summaryrefslogtreecommitdiff
path: root/tools/release.sh
diff options
context:
space:
mode:
authorJames Mills <prologic@shortcircuit.net.au>2020-03-21 08:20:16 +1000
committerJames Mills <prologic@shortcircuit.net.au>2020-03-21 08:20:16 +1000
commitd7a1eab5beba4241dab4402c5cd268432d7b46cd (patch)
tree6383b4ebf511b58597d827dc5af00b71c72caf38 /tools/release.sh
parent13ffd7117180d1a3093ff291481caeb07a8b71de (diff)
Migrate to Go111Modules, Add Dockerfile and GoRelaser support
Diffstat (limited to 'tools/release.sh')
-rwxr-xr-xtools/release.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/release.sh b/tools/release.sh
new file mode 100755
index 0000000..e8ab44e
--- /dev/null
+++ b/tools/release.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# Get the highest tag number
+VERSION="$(git describe --abbrev=0 --tags)"
+VERSION=${VERSION:-'0.0.0'}
+
+# Get number parts
+MAJOR="${VERSION%%.*}"; VERSION="${VERSION#*.}"
+MINOR="${VERSION%%.*}"; VERSION="${VERSION#*.}"
+PATCH="${VERSION%%.*}"; VERSION="${VERSION#*.}"
+
+# Increase version
+PATCH=$((PATCH+1))
+
+TAG="${1}"
+
+if [ "${TAG}" = "" ]; then
+ TAG="${MAJOR}.${MINOR}.${PATCH}"
+fi
+
+echo "Releasing ${TAG} ..."
+
+git tag -a -s -m "Release ${TAG}" "${TAG}"
+git push --tags
+goreleaser release --rm-dist