From c3c2b493044bcb6fb439172d3c0a90a5f36f72f4 Mon Sep 17 00:00:00 2001 From: Roy Sommer Date: Thu, 23 Jan 2020 21:20:09 +0200 Subject: now automatically adding release tag whenever released --- hooks/make_release_commit.py | 19 +++++++++++++++++++ hooks/tag_release.py | 19 ------------------- pyproject.toml | 8 ++++---- 3 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 hooks/make_release_commit.py delete mode 100644 hooks/tag_release.py diff --git a/hooks/make_release_commit.py b/hooks/make_release_commit.py new file mode 100644 index 0000000..34caea6 --- /dev/null +++ b/hooks/make_release_commit.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/hooks/tag_release.py b/hooks/tag_release.py deleted file mode 100644 index 34caea6..0000000 --- a/hooks/tag_release.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/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 7d2f679..b733244 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,16 +36,16 @@ lint = "./task lint_pylint && ./task lint_mypy" lint_pylint = "pylint tests taskipy" lint_mypy = "mypy tests taskipy" -pre_publish = "./task test" publish = "poetry publish --build" +post_publish = "./task make_release_commit" -commit_release = "python ./hooks/tag_release.py" +make_release_commit = "python ./hooks/make_release_commit.py" pre_publish_patch = "./task test" -publish_patch = "poetry version patch && commit_release && poetry publish --build" +publish_patch = "poetry version patch && ./task publish" pre_publish_minor = "./task test" -publish_minor = "poetry version minor && commit_release && poetry publish --build" +publish_minor = "poetry version minor && ./task publish" [build-system] requires = ["poetry>=0.12"] -- cgit v1.2.3