streams-ops/bump-tag

58 lines
1.2 KiB
Plaintext
Raw Normal View History

#!/bin/bash
2013-10-31 20:50:04 +00:00
set -e
test -f cosmos.conf && . ./cosmos.conf
echo "Fetching any updates from server:"
git pull
echo ""
if [ "x$1" = "x" ]; then
deftag=`basename $PWD`
else
deftag="$1"
fi
2013-10-31 20:50:04 +00:00
tagpfx=${tag:="$deftag"}
last_tag=`git tag -l "${tagpfx}-*"|sort|tail -1`
echo "Verifying last tag $last_tag:"
(git tag -v $last_tag | grep ^gpg:) || true
# again to not mask exit status of git with grep
git tag -v $last_tag > /dev/null 2>&1
echo ""
2013-10-31 20:50:04 +00:00
echo "Differences between tag $last_tag and what you are about to sign:"
2023-04-25 15:19:18 +00:00
this_branch=$(git rev-parse --abbrev-ref HEAD)
PAGER=cat git diff --color $last_tag..$this_branch
2013-10-31 20:50:04 +00:00
iter=1
ok=
while test -z "$ok"; do
this_tag=$(date +${tagpfx}-%Y-%m-%d-v`printf "%02d" $iter`)
iter=`expr $iter + 1`
case `(echo $this_tag; echo $last_tag) | sort | tail -1` in
$last_tag)
;;
$this_tag)
ok=yes
;;
esac
done
if [ "$deftag" != "$tagpfx" ]; then
echo -e "Using new tag \e[94m$this_tag\e[0m according to pattern in cosmos.conf"
else
echo -e "Using new tag \e[94m$this_tag\e[0m"
fi
echo -e "\e[1mONLY SIGN IF YOU APPROVE OF VERIFICATION AND DIFF ABOVE\e[0m"
2013-10-31 20:50:04 +00:00
# GITTAGEXTRA is for putting things like "-u 2117364A"
git tag $GITTAGEXTRA -m bump. -s $this_tag
git push
git push --tags