aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hooks/tag_release.py19
-rw-r--r--pyproject.toml8
2 files changed, 23 insertions, 4 deletions
diff --git a/hooks/tag_release.py b/hooks/tag_release.py
new file mode 100644
index 0000000..34caea6
--- /dev/null
+++ b/hooks/tag_release.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+import toml
+import subprocess
+import os
+from os import path
+
+def create_release_commit():
+ pyproject = toml.load(path.join(os.curdir, 'pyproject.toml'))
+ version = pyproject['tool']['poetry']['version']
+
+ p = subprocess.Popen(f'git add . && git commit -m "Release version {version}" && git tag -a "{version}" -m "Release version {version}" && git push && git push --tags',
+ shell=True,
+ cwd=os.curdir)
+
+ p.wait()
+
+if __name__ == '__main__':
+ create_release_commit()
+
diff --git a/pyproject.toml b/pyproject.toml
index d2e0298..7d2f679 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -39,13 +39,13 @@ lint_mypy = "mypy tests taskipy"
pre_publish = "./task test"
publish = "poetry publish --build"
+commit_release = "python ./hooks/tag_release.py"
+
pre_publish_patch = "./task test"
-bump_patch_version = "poetry version patch && git add . && git commit -m 'bumped patch version' && git push"
-publish_patch = "./task bump_patch_version && poetry publish --build"
+publish_patch = "poetry version patch && commit_release && poetry publish --build"
pre_publish_minor = "./task test"
-bump_minor_version = "poetry version minor && git add . && git commit -m 'bumped minor version' && git push"
-publish_minor = "./task bump_minor_version && poetry publish --build"
+publish_minor = "poetry version minor && commit_release && poetry publish --build"
[build-system]
requires = ["poetry>=0.12"]