#!/usr/bin/env bash
set -e

tag="$1"
MESSAGE="New release ${tag}"

# This script creates a release tag

if git rev-parse -q --verify "refs/tags/$tag" >/dev/null; then
    echo -e ' - Tag already exists...'
	git tag -d $tag
	git push origin :refs/tags/$tag
	git tag -a $tag -m "$MESSAGE"
else
	git tag -a $tag -m "$MESSAGE"
fi