Skip to content

Instantly share code, notes, and snippets.

@ibiqlik
Created November 5, 2020 22:00
Show Gist options
  • Save ibiqlik/1a648d87cf9d29d382e9b7a3de37cde8 to your computer and use it in GitHub Desktop.
Save ibiqlik/1a648d87cf9d29d382e9b7a3de37cde8 to your computer and use it in GitHub Desktop.
Makefile bump git tag and push
RELEASE_TYPE ?= patch
LATEST_TAG ?= $(shell git ls-remote -q --tags --sort=-v:refname | head -n1 | awk '{ print $2 }' | sed 's/refs\/tags\///g')
LATEST_SHA ?= $(shell git rev-parse origin/main)
NEW_TAG ?= $(shell docker run -it --rm alpine/semver semver -c -i $(RELEASE_TYPE) $(LATEST_TAG))
release:
git tag "v$(NEW_TAG)" $(LATEST_SHA)
git push origin "v$(NEW_TAG)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment