Skip to content

Instantly share code, notes, and snippets.

@fpersson
Forked from ibiqlik/makefile
Created December 1, 2023 14:32
Show Gist options
  • Save fpersson/c880c1ecdd09a01d7dab0a08a1f6b1cd to your computer and use it in GitHub Desktop.
Save fpersson/c880c1ecdd09a01d7dab0a08a1f6b1cd 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