Skip to content

Instantly share code, notes, and snippets.


esseti/ Secret

Created Jun 27, 2018
What would you like to do?
new tag git
def current_tag():
tag = local('git describe --tags $(git rev-list --tags --max-count=1)', capture=True)
return tag
def new_tag(test):
#create new tag
if type(test) != bool:
test = strtobool(test)
last_tag = current_tag()
last_tag = '0.0'
versions = last_tag.split('.')
if test:
# we change the last number 0.X+1
versions[1] = str(int(versions[1]) + 1)
# if prod we change the first X+1.0
versions[0] = str(int(versions[0]) + 1)
versions[1] = "0"
tag = ".".join(versions)
print(green("new tag %s " % tag))
return tag
def git_tag(tag=None, message='tag version', test=True):
if not tag:
tag = new_tag(test=test)
local('git tag -a "%s" -m "%s"' % (tag, message))
local('git push origin %s' % tag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment