Skip to content

Instantly share code, notes, and snippets.

@fordnox
Last active November 2, 2020 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fordnox/837ded1d02eff3ff7b378e296e159a4a to your computer and use it in GitHub Desktop.
Save fordnox/837ded1d02eff3ff7b378e296e159a4a to your computer and use it in GitHub Desktop.
Makefile semver
git fetch --prune origin "+refs/tags/*:refs/tags/*"
.SILENT:
revbump:
set -e ;\
git tag --sort=v:refname | tail -1
NEW_VERSION=$$( git tag --sort=v:refname | tail -1 | awk 'BEGIN{FS=OFS="."}{print $$1,$$2,$$3+1}' ) ;\
echo "unstable release $$NEW_VERSION" ;\
git tag $$NEW_VERSION
git push --tags
minorbump:
set -e ;\
git tag --sort=v:refname | tail -1
NEW_VERSION=$$( git tag --sort=v:refname | tail -1 | awk 'BEGIN{FS=OFS="."}{print $$1,$$2+1,0}' ) ;\
echo "unstable release $$NEW_VERSION" ;\
git tag $$NEW_VERSION
git push --tags
majorbump:
set -e ;\
git tag --sort=v:refname | tail -1
NEW_VERSION=$$( git tag --sort=v:refname | tail -1 | awk 'BEGIN{FS=OFS="."}{print $$1+1,0,0}' ) ;\
echo "release $$NEW_VERSION" ;\
git tag $$NEW_VERSION
git push --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment