From f94320952c190a4b78c1fcca323aed5e6c321007 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sat, 3 Aug 2019 00:07:08 +0200 Subject: [PATCH] Added release helper script --- tools/release.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 tools/release.sh diff --git a/tools/release.sh b/tools/release.sh new file mode 100755 index 0000000..4dc0eae --- /dev/null +++ b/tools/release.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +if ! command -v goreleaser; then + echo "goreleaser not found" + exit 1 +fi + +# 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