diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index b15d2ff..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,22 +0,0 @@ -[bumpversion] -current_version = 1.2.0 -parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\.?)(?P[a-z]*)(?P\d*) -serialize = - {major}.{minor}.{patch}.{release}{relver} - {major}.{minor}.{patch} -commit = True -tag = True -sign_tags = True -tag_name = {new_version} -message = Release {new_version} - -[bumpversion:part:release] -optional_value = gamma -values = - dev - a - b - rc - gamma - -[bumpversion:file:taiga/__init__.py] diff --git a/.readthedocs.yml b/.readthedocs.yml index 0086f8a..a076dba 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -20,4 +20,3 @@ python: path: . extra_requirements: - docs - system_packages: false diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 2724240..3321ceb 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -153,15 +153,17 @@ Release a version #. Update authors file #. Merge ``develop`` on ``master`` branch -#. Bump release via task: ``inv tag-release (major|minor|patch)`` +#. Bump release via task: ``inv tag-release --level=(major|minor|patch)`` #. Update changelog via towncrier: ``towncrier --yes`` -#. Commit changelog with ``git commit --amend`` to merge with bumpversion commit +#. Commit changelog with ``git commit --amend`` to merge with bump-my-version commit #. Create tag ``git tag `` #. Push tag to github #. Publish the release from the tags page #. If pipeline succeeds, push ``master`` #. Merge ``master`` back on ``develop`` -#. Bump developement version via task: ``inv tag-dev -l (major|minor|patch)`` +#. Bump developement version via task: ``inv tag-dev --level=release`` #. Push ``develop`` +To increment dev version use ``inv tag-dev --level=relver``` (e.g. to pass from ``1.2.0.dev1`` to ``1.2.0.dev2``) + .. _towncrier: https://pypi.org/project/towncrier/#news-fragments diff --git a/changes/140.feature b/changes/140.feature new file mode 100644 index 0000000..7c21d74 --- /dev/null +++ b/changes/140.feature @@ -0,0 +1 @@ +Switch to bump-my-version diff --git a/pyproject.toml b/pyproject.toml index ec767d2..38fb540 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,3 +46,35 @@ target-version = "py310" [tool.ruff.mccabe] max-complexity = 10 + +[tool.bumpversion] +allow_dirty = false +commit = true +message = "Release {new_version}" +commit_args = "--no-verify" +tag = false +current_version = "1.2.0" +parse = """(?x) + (?P[0-9]+) + \\.(?P[0-9]+) + \\.(?P[0-9]+) + (?: + .(?Pdev) + (?:(?P[0-9]+))? + )? +""" +serialize = [ + "{major}.{minor}.{patch}.{release}{relver}", + "{major}.{minor}.{patch}" +] + +[tool.bumpversion.parts.release] +values = [ + "dev", + "" +] +optional_value = "dev" + +[[tool.bumpversion.files]] +filename = "taiga/__init__.py" +search = "{current_version}" diff --git a/tasks.py b/tasks.py index 607e27a..d8c0510 100644 --- a/tasks.py +++ b/tasks.py @@ -39,8 +39,8 @@ def format(c): # NOQA def towncrier_check(c): # NOQA """Check towncrier files.""" output = io.StringIO() - c.run("git branch --contains HEAD", out_stream=output) - skipped_branch_prefix = ["pull/", "develop", "master", "HEAD"] + c.run("git branch -a --contains HEAD", out_stream=output) + skipped_branch_prefix = ["pull/", "release/", "develop", "master", "HEAD"] # cleanup branch names by removing PR-only names in local, remote and disconnected branches to ensure the current # (i.e. user defined) branch name is used branches = list( @@ -52,10 +52,8 @@ def towncrier_check(c): # NOQA ), ) ) - print("Candidate branches", ", ".join(output.getvalue().split("\n"))) if not branches: # if no branch name matches, we are in one of the excluded branches above, so we just exit - print("Skip check, branch excluded by configuration") return branch = branches[0] towncrier_file = None @@ -109,15 +107,22 @@ def coverage(c): @task -def tag_release(c, level): +def tag_release(c, level, new_version=""): """Tag release version.""" - c.run("bumpversion --list %s --no-tag" % level) + if new_version: + new_version = f" --new-version {new_version}" + c.run(f"bump-my-version bump {level}{new_version}") @task -def tag_dev(c, level="patch"): +def tag_dev(c, level, new_version=""): """Tag development version.""" - c.run("bumpversion --list %s --message='Bump develop version [ci skip]' --no-tag" % level) + if new_version: + new_version = f" --new-version {new_version}" + elif level == "release": + c.run("bump-my-version bump patch --no-commit") + level = "relver" + c.run(f"bump-my-version bump {level} --message='Bump develop version [ci skip]' {new_version} --allow-dirty") @task(pre=[clean])