blob: 86b41d8904b2b4620c30cbb7ff04d36e2cd60b23 [file] [log] [blame]
Harald Welteee497f22017-10-03 16:54:41 +08001#!/bin/sh
2VERSION=$1
3REL=$2
4
5if [ "z$REL" = "z" ]; then
6 echo "No REL value specified, defaulting to 'patch' release"
7 REL=patch
8fi
9
10BUMPVER=`command -v bumpversion`
11
12NEW_VER=`bumpversion --list --current-version $VERSION $REL --allow-dirty | awk -F '=' '{ print $2 }'`
13LIBVERS=`git grep -n LIBVERSION | grep '=' | grep am | grep -v LDFLAGS`
Pau Espin Pedrol01dd5702018-05-03 15:01:47 +020014MAKEMOD=`git diff --cached -GLIBVERSION --stat | grep Makefile.am`
Harald Welteee497f22017-10-03 16:54:41 +080015ISODATE=`date -I`
16
17if [ "z$BUMPVER" = "z" ]; then
18 echo Unable to find 'bumpversion' command.
19 exit 1
20fi
21
22if [ "z$NEW_VER" = "z" ]; then
23 echo "Please fix versioning to match http://semver.org/ spec (current is $VERSION) before proceeding."
24 exit 1
25fi
26
27echo "Releasing $VERSION -> $NEW_VER..."
28
Pau Espin Pedrol01dd5702018-05-03 15:01:47 +020029if [ "z$LIBVERS" != "z" ]; then
Harald Welteee497f22017-10-03 16:54:41 +080030 if [ "z$MAKEMOD" = "z" ]; then
Pau Espin Pedrol0b0f9082018-05-02 15:58:37 +020031 echo "Before releasing, please modify some of the libversions: $LIBVERS"
Pau Espin Pedrol01dd5702018-05-03 15:01:47 +020032 echo "You should NOT be doing this unless you've read and understood following article:"
33 echo "https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info"
Pau Espin Pedrol0b0f9082018-05-02 15:58:37 +020034 exit 1
Harald Welteee497f22017-10-03 16:54:41 +080035 fi
Pau Espin Pedrol01dd5702018-05-03 15:01:47 +020036 if [ -f "TODO-RELEASE" ]; then
37 grep '#' TODO-RELEASE > TODO-RELEASE.clean
38 mv TODO-RELEASE.clean TODO-RELEASE
39 git add TODO-RELEASE
40 fi
Harald Welteee497f22017-10-03 16:54:41 +080041fi
Pau Espin Pedrol01dd5702018-05-03 15:01:47 +020042gbp dch --debian-tag='%(version)s' --auto --meta --git-author --multimaint-merge --ignore-branch --new-version="$NEW_VER"
Harald Welteee497f22017-10-03 16:54:41 +080043dch -r -m --distribution "unstable" ""
Pau Espin Pedrol01dd5702018-05-03 15:01:47 +020044git add debian/changelog
Harald Welteee497f22017-10-03 16:54:41 +080045bumpversion --current-version $VERSION $REL --tag --commit --tag-name $NEW_VER --allow-dirty
Pau Espin Pedrolbf819322018-05-03 15:25:11 +020046git commit --amend # let the user add extra information to the release commit.
Harald Welteee497f22017-10-03 16:54:41 +080047git tag -s $NEW_VER -f -m "Release v$NEW_VER on $ISODATE."
48echo "Release $NEW_VER prepared, tagged and signed."