Skip to content

Instantly share code, notes, and snippets.

@wojtek-oledzki
Created November 24, 2020 12:29
Show Gist options
  • Save wojtek-oledzki/efb737a0a36d7eef6c79da3563f4d24f to your computer and use it in GitHub Desktop.
Save wojtek-oledzki/efb737a0a36d7eef6c79da3563f4d24f to your computer and use it in GitHub Desktop.
bumpup
VERSION ?= $(shell git describe --tags --match "$(VERSION_BASE)*" || echo $(VERSION_BASE).0)
VERSION_BASE ?= $(shell cat "$(PWD)/.version")
## Create new version tag based on the nearest tag
version.bumpup:
@git fetch --tags
@git tag $$((git describe --abbrev=0 --tags --match "$(VERSION_BASE)*" || echo $(VERSION_BASE).-1) | perl -pe 's/^(v(\d+\.)*)(-?\d+)(.*)$$/$$1.($$3+1).$$4/e')
$(MAKE) version.pprint
@echo "Remember to push new tag to remote server."
## Push current version tag
version.push:
git push --no-verify origin tag $(VERSION)
## Prints current version
version.print:
@echo "$(VERSION)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment