summaryrefslogtreecommitdiffstats
path: root/contrib/release/do-release.sh
blob: 112729352360ec3d5fb7eb6476e2a89ca1420def (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh

set -e

do_minor=false
do_major=false

while [ $# -gt 0 ]; do
    case "$1" in
	--minor)
	    do_minor=true
	    ;;
	--major)
	    do_major=true
	    ;;
	*)
	    echo "Unknown option: $1"
	    exit 1
    esac
    shift
done

if $do_minor && $do_major; then
    echo "Can only bump minor or major, not both"
    exit 1
fi

if ! $do_minor && ! $do_major; then
    echo "Need to bump minor or major"
    exit 1
fi

git checkout master

version=$(cat VERSION)

minor=$(echo $version \
	    | sed 's/.*\.//')
major=$(echo $version \
	    | sed 's/\..*//')
echo Current version: major: $major,  minor: $minor

if $do_minor; then
    echo "Bumping minor version"
    minor=$(($minor + 1))
elif $do_major; then
    echo "Bumping major version"
    major=$(($major + 1))
    minor=0
fi
echo Bumped version: major: $major,  minor: $minor

version=$major.$minor

set +x

echo $version > VERSION

git add VERSION

git commit -m "Bump version to $version"

git push origin master:master

git tag -s -m "dwz $version release" dwz-$version

git push origin dwz-$version