Harald Welte | ee497f2 | 2017-10-03 16:54:41 +0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | VERSION=$1 |
| 3 | REL=$2 |
| 4 | |
| 5 | if [ "z$REL" = "z" ]; then |
| 6 | echo "No REL value specified, defaulting to 'patch' release" |
| 7 | REL=patch |
| 8 | fi |
| 9 | |
| 10 | BUMPVER=`command -v bumpversion` |
| 11 | |
| 12 | NEW_VER=`bumpversion --list --current-version $VERSION $REL --allow-dirty | awk -F '=' '{ print $2 }'` |
| 13 | LIBVERS=`git grep -n LIBVERSION | grep '=' | grep am | grep -v LDFLAGS` |
Pau Espin Pedrol | 01dd570 | 2018-05-03 15:01:47 +0200 | [diff] [blame] | 14 | MAKEMOD=`git diff --cached -GLIBVERSION --stat | grep Makefile.am` |
Harald Welte | ee497f2 | 2017-10-03 16:54:41 +0800 | [diff] [blame] | 15 | ISODATE=`date -I` |
| 16 | |
| 17 | if [ "z$BUMPVER" = "z" ]; then |
| 18 | echo Unable to find 'bumpversion' command. |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | if [ "z$NEW_VER" = "z" ]; then |
| 23 | echo "Please fix versioning to match http://semver.org/ spec (current is $VERSION) before proceeding." |
| 24 | exit 1 |
| 25 | fi |
| 26 | |
| 27 | echo "Releasing $VERSION -> $NEW_VER..." |
| 28 | |
Pau Espin Pedrol | 01dd570 | 2018-05-03 15:01:47 +0200 | [diff] [blame] | 29 | if [ "z$LIBVERS" != "z" ]; then |
Harald Welte | ee497f2 | 2017-10-03 16:54:41 +0800 | [diff] [blame] | 30 | if [ "z$MAKEMOD" = "z" ]; then |
Pau Espin Pedrol | 0b0f908 | 2018-05-02 15:58:37 +0200 | [diff] [blame] | 31 | echo "Before releasing, please modify some of the libversions: $LIBVERS" |
Pau Espin Pedrol | 01dd570 | 2018-05-03 15:01:47 +0200 | [diff] [blame] | 32 | 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 Pedrol | 0b0f908 | 2018-05-02 15:58:37 +0200 | [diff] [blame] | 34 | exit 1 |
Harald Welte | ee497f2 | 2017-10-03 16:54:41 +0800 | [diff] [blame] | 35 | fi |
Pau Espin Pedrol | 01dd570 | 2018-05-03 15:01:47 +0200 | [diff] [blame] | 36 | 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 Welte | ee497f2 | 2017-10-03 16:54:41 +0800 | [diff] [blame] | 41 | fi |
Pau Espin Pedrol | 01dd570 | 2018-05-03 15:01:47 +0200 | [diff] [blame] | 42 | gbp dch --debian-tag='%(version)s' --auto --meta --git-author --multimaint-merge --ignore-branch --new-version="$NEW_VER" |
Harald Welte | ee497f2 | 2017-10-03 16:54:41 +0800 | [diff] [blame] | 43 | dch -r -m --distribution "unstable" "" |
Pau Espin Pedrol | 01dd570 | 2018-05-03 15:01:47 +0200 | [diff] [blame] | 44 | git add debian/changelog |
Harald Welte | ee497f2 | 2017-10-03 16:54:41 +0800 | [diff] [blame] | 45 | bumpversion --current-version $VERSION $REL --tag --commit --tag-name $NEW_VER --allow-dirty |
Pau Espin Pedrol | bf81932 | 2018-05-03 15:25:11 +0200 | [diff] [blame] | 46 | git commit --amend # let the user add extra information to the release commit. |
Harald Welte | ee497f2 | 2017-10-03 16:54:41 +0800 | [diff] [blame] | 47 | git tag -s $NEW_VER -f -m "Release v$NEW_VER on $ISODATE." |
| 48 | echo "Release $NEW_VER prepared, tagged and signed." |