summaryrefslogtreecommitdiff
path: root/bump-tag
blob: aed35e24cb0f3bd868f8e9b7744ec79fb2b4a426 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh

set -e

test -f cosmos.conf && . ./cosmos.conf

git pull

deftag=`basename $PWD`
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 ""

echo "Differences between tag $last_tag and what you are about to sign:"
PAGER=cat git diff $last_tag..master

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

echo ""
echo "Using new tag $this_tag"
echo ONLY SIGN IF YOU APPROVE OF VERIFICATION AND DIFF ABOVE

# GITTAGEXTRA is for putting things like "-u 2117364A"

git tag $GITTAGEXTRA -m bump. -s $this_tag

git push
git push --tags