From 3f8b8aedfc94bf5079c74c52e235041dce2067e9 Mon Sep 17 00:00:00 2001 From: Roy Sommer Date: Thu, 25 May 2023 23:54:07 +0300 Subject: getting ready to release --- .gitignore | 1 + .hooks/make_release_commit.py | 23 +++++++++++++++++++++++ pyproject.toml | 12 +++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .hooks/make_release_commit.py diff --git a/.gitignore b/.gitignore index 1b8e35e..fba5fc5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ __pycache__ .pytest_cache dist .coverage +.vscode diff --git a/.hooks/make_release_commit.py b/.hooks/make_release_commit.py new file mode 100644 index 0000000..77b1971 --- /dev/null +++ b/.hooks/make_release_commit.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +import tomli +import subprocess +from pathlib import Path + + +def create_release_commit(): + cwd = Path.cwd() + with open(cwd / "pyproject.toml", "rb") as file: + pyproject = tomli.load(file) + 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=cwd, + ) + + p.wait() + + +if __name__ == "__main__": + create_release_commit() diff --git a/pyproject.toml b/pyproject.toml index 0134fb5..d9c998e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "poetry-plugin-taskipy" -version = "0.1.0" +version = "1.0.0" description = "Poetry plugin for taskipy" authors = ["Taskipy Team"] license = "MIT" @@ -51,6 +51,16 @@ black {module_dir} {tests_dir} \ lint_analyze = "flake8 {module_dir} {tests_dir}" lint_types = "mypy {module_dir} {tests_dir}" +pre_publish = "task test" +publish = { cmd = "poetry publish --build", help = "publishes taskipy to PyPI as is. do not use directly" } +post_publish = "task make_release_commit" + +make_release_commit = { cmd = "python ./.hooks/make_release_commit.py", help = "creates a tagged commit for the release. do not use directly" } + +publish_patch = { cmd = "poetry version patch && task publish", help = "publishes a patch version, that has only fixes but no new features (x.x.PATCH)" } + +publish_minor = { cmd = "poetry version minor && task publish", help = "publishes a minor version, which has new fetures (x.MINOR.x)" } + [tool.taskipy.settings] use_vars = true -- cgit v1.2.3