1
0
mirror of https://github.com/ihabunek/toot.git synced 2024-06-16 06:15:25 +00:00

Add checks to tag script

This commit is contained in:
Ivan Habunek 2019-09-03 16:45:31 +02:00
parent 7986d3a6bc
commit e9acd6daf7
No known key found for this signature in database
GPG Key ID: CDBD63C43A30BB95

View File

@ -12,9 +12,11 @@ import subprocess
import sys
import textwrap
import yaml
import toot
from datetime import date
from os import path
from pkg_resources import get_distribution
path = path.join(path.dirname(path.dirname(path.abspath(__file__))), "changelog.yaml")
with open(path, "r") as f:
@ -25,12 +27,21 @@ if len(sys.argv) != 2:
sys.exit(1)
version = sys.argv[1]
changelog_item = changelog.get(version)
changelog_item = changelog.get(version)
if not changelog_item:
print(f"Version `{version}` not found in changelog.", file=sys.stderr)
sys.exit(1)
if toot.__version__ != version:
print(f"toot.__version__ is `{toot.__version__}`, expected {version}.", file=sys.stderr)
sys.exit(1)
dist_version = get_distribution('toot').version
if dist_version != version:
print(f"Version in setup.py is `{dist_version}`, expected {version}.", file=sys.stderr)
sys.exit(1)
release_date = changelog_item["date"]
changes = changelog_item["changes"]
@ -47,7 +58,11 @@ for c in changes:
initial = False
commit_message += f"{lead} {line}\n"
subprocess.run(["git", "tag", "-a", version, "-m", commit_message])
proc = subprocess.run(["git", "tag", "-a", version, "-m", commit_message])
if proc.returncode != 0:
sys.exit(1)
print("Tagged version:")
print()
print(commit_message)
print()
print(f"Version {version} tagged \\o/")