path: root/osmo-release.mk
diff options
authorMax <msuraev@sysmocom.de>2017-07-04 18:19:38 +0200
committerHarald Welte <laforge@gnumonks.org>2017-08-08 11:55:03 +0000
commitff932bbc38661a327382495de1e30b521a91b548 (patch)
treed5b574f48af55a2acc48e9b22626d61d0500d46f /osmo-release.mk
parenta8a8d3977dc3b31352f8a87ca005763677bd7e8c (diff)
Add release target to Makefile
Add simple helper target to automate basic release steps: * version bump * prepare release commit * git commit, tag and sign For library projects: * update debian/changelog from TODO-RELEASE * cleanup TODO-RELEASE For non-library projects: * update debian/changelog from git log Note: it requires bumpversion package to be installed, debian/control is adjusted accordingly. The helper itself is installed to facilitate reuse by other libraries. N. B: you still have to manually adjust LIBVERSION in previous commit - see TODO-RELEASE header for details. Use it as follows: make REL=minor release The REL parameter defines which component of the version [1] to bump and can be any of { major, minor, patch }. [1] http://semver.org/ Change-Id: I790ceb958195b9f6cbabfe8c977dc30e2bd7414b Related: OS#1861
Diffstat (limited to 'osmo-release.mk')
1 files changed, 28 insertions, 0 deletions
diff --git a/osmo-release.mk b/osmo-release.mk
new file mode 100644
index 00000000..4407c861
--- /dev/null
+++ b/osmo-release.mk
@@ -0,0 +1,28 @@
+ifdef REL
+NEW_VERSION := $(shell bumpversion --list --current-version $(VERSION) $(REL) --allow-dirty | awk -F '=' '{ print $$2 }')
+LIBVERS := $(shell git grep -n LIBVERSION | grep '=' | grep am | grep -v LDFLAGS)
+ISODATE := $(shell date -I)
+ifeq ($(NEW_VERSION),)
+ @$(error Failed to determine NEW_VERSION - please fix versioning (current is $(VERSION)) before proceeding with the release)
+ @echo "Releasing" $(VERSION) "->" $(NEW_VERSION)"..."
+ifeq ($(LIBVERS),)
+ @gbp dch --debian-tag='%(version)s' --auto --meta --git-author --multimaint-merge
+ @echo "You should NOT be doing this unless you've read and understood following article:"
+ @echo "https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info"
+ @grep -v '#' TODO-RELEASE | sed 's/\t\+/:/g' | xargs -d'\n' -I entry dch -m -v $(NEW_VERSION) "entry"
+ @dch -r -m --distribution "unstable" ""
+ @grep '#' TODO-RELEASE > TODO-RELEASE.clean
+ @echo "Do NOT push the release commit if you have not adjusted LIBVERSION in preceeding commit!!!"
+ @echo "Are you sure the following versions are correct?"
+ @echo $(LIBVERS)
+ @git add -u
+ @bumpversion --current-version $(VERSION) $(REL) --tag --commit --tag-name $(NEW_VERSION) --allow-dirty
+ @git tag -s $(NEW_VERSION) -f -m "Release v$(NEW_VERSION) on $(ISODATE)."
+ @echo "Release" $(NEW_VERSION) "prepared, tagged and signed."