Max | 031ac91 | 2017-08-25 14:22:18 +0200 | [diff] [blame] | 1 | ifndef REL |
| 2 | REL := patch |
Max | ff932bb | 2017-07-04 18:19:38 +0200 | [diff] [blame] | 3 | endif |
| 4 | |
Max | 98f6482 | 2017-09-04 17:15:13 +0200 | [diff] [blame] | 5 | BUMPVER := $(shell bumpversion) |
Max | 031ac91 | 2017-08-25 14:22:18 +0200 | [diff] [blame] | 6 | NEW_VER := $(shell bumpversion --list --current-version $(VERSION) $(REL) --allow-dirty | awk -F '=' '{ print $$2 }') |
| 7 | LIBVERS := $(shell git grep -n LIBVERSION | grep '=' | grep am | grep -v LDFLAGS) |
| 8 | MAKEMOD := $(shell git diff -GLIBVERSION --stat | grep Makefile.am) |
| 9 | ISODATE := $(shell date -I) |
| 10 | |
Max | ff932bb | 2017-07-04 18:19:38 +0200 | [diff] [blame] | 11 | release: |
Max | 031ac91 | 2017-08-25 14:22:18 +0200 | [diff] [blame] | 12 | |
Max | 98f6482 | 2017-09-04 17:15:13 +0200 | [diff] [blame] | 13 | ifeq ($(BUMPVER),) |
| 14 | @$(error Unable to find 'bumpversion' command.) |
| 15 | endif |
| 16 | |
Max | 031ac91 | 2017-08-25 14:22:18 +0200 | [diff] [blame] | 17 | ifeq ($(NEW_VER),) |
| 18 | @$(error Please fix versioning to match http://semver.org/ spec (current is $(VERSION)) before proceeding.) |
Max | ff932bb | 2017-07-04 18:19:38 +0200 | [diff] [blame] | 19 | endif |
Max | 031ac91 | 2017-08-25 14:22:18 +0200 | [diff] [blame] | 20 | |
| 21 | ifeq ($(origin REL), file) |
| 22 | @echo "No REL value specified, defaulting to 'patch' release" |
| 23 | endif |
| 24 | |
| 25 | @echo "Releasing" $(VERSION) "->" $(NEW_VER)"..." |
| 26 | |
Max | ff932bb | 2017-07-04 18:19:38 +0200 | [diff] [blame] | 27 | ifeq ($(LIBVERS),) |
Max | d5962a8 | 2017-08-24 13:24:04 +0200 | [diff] [blame] | 28 | @gbp dch --debian-tag='%(version)s' --auto --meta --git-author --multimaint-merge --ignore-branch |
Max | ff932bb | 2017-07-04 18:19:38 +0200 | [diff] [blame] | 29 | else |
| 30 | @echo "You should NOT be doing this unless you've read and understood following article:" |
| 31 | @echo "https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info" |
Max | 031ac91 | 2017-08-25 14:22:18 +0200 | [diff] [blame] | 32 | @grep -v '#' TODO-RELEASE | sed 's/\t\+/: /g' > TODO-RELEASE.entries |
Max | ff932bb | 2017-07-04 18:19:38 +0200 | [diff] [blame] | 33 | @grep '#' TODO-RELEASE > TODO-RELEASE.clean |
| 34 | @mv TODO-RELEASE.clean TODO-RELEASE |
Max | 031ac91 | 2017-08-25 14:22:18 +0200 | [diff] [blame] | 35 | ifeq ($(MAKEMOD),) |
| 36 | @$(if $(shell git status -s -uno TODO-RELEASE),,$(error Before releasing, please modify some of the libversions: $(LIBVERS))) |
Max | ff932bb | 2017-07-04 18:19:38 +0200 | [diff] [blame] | 37 | endif |
Max | 031ac91 | 2017-08-25 14:22:18 +0200 | [diff] [blame] | 38 | @xargs -a TODO-RELEASE.entries -r -d'\n' -I entry dch -m -v $(NEW_VER) "entry" |
| 39 | endif |
| 40 | @dch -r -m --distribution "unstable" "" |
Max | ff932bb | 2017-07-04 18:19:38 +0200 | [diff] [blame] | 41 | @git add -u |
Max | 031ac91 | 2017-08-25 14:22:18 +0200 | [diff] [blame] | 42 | @bumpversion --current-version $(VERSION) $(REL) --tag --commit --tag-name $(NEW_VER) --allow-dirty |
| 43 | @git tag -s $(NEW_VER) -f -m "Release v$(NEW_VER) on $(ISODATE)." |
| 44 | @echo "Release" $(NEW_VER) "prepared, tagged and signed." |