INNER CODE UNIT · Python
semver_tags
lissy93/portainer-templates · lib/changelog.py:43
def semver_tags():
"""All vMAJOR.MINOR.PATCH tags from FIRST_VERSION onwards, oldest first"""
tags = [t for t in git('tag').splitlines() if SEMVER_TAG.match(t)]
return sorted((t for t in tags if version(t) >= FIRST_VERSION), key=version)
def tag_dates():
"""Map of tag -> creation date (YYYY-MM-DD)"""
lines = git('for-each-ref', '--format=%(refname:short) %(creatordate:short)',
'refs/tags').splitlines()
return dict(line.split(' ', 1) for line in lines if ' ' in line)
def templates_at(tag):
"""Templates in templates.json at a tag, keyed by title with `id` dropped.
Returns None if the file doesn't exist at that tag."""
try:
raw = git('show', f'{tag}:templates.json')
except subprocess.CalledProcessError:
return None