From 91f48dd7da3029c7a5d42e28979edb0651efc09d Mon Sep 17 00:00:00 2001 From: Leonardo Cavallucci Date: Thu, 24 Aug 2023 15:13:14 +0200 Subject: [PATCH 1/4] Add bump-my-version config --- .bumpversion.cfg | 22 ---------------------- changes/140.feature | 1 + pyproject.toml | 32 ++++++++++++++++++++++++++++++++ tasks.py | 27 +++++++++++++-------------- 4 files changed, 46 insertions(+), 36 deletions(-) delete mode 100644 .bumpversion.cfg create mode 100644 changes/140.feature 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/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..d987d76 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]) @@ -138,9 +143,3 @@ def docserve(c): server.watch("CONTRIBUTING.rst", lambda: docbuild(c)) server.watch("docs/*.rst", lambda: docbuild(c)) server.serve(port=DOCS_PORT, root="_build/html") - - -@task -def deb(c): - """Build debian package.""" - c.run("debuild -us -uc -b") From d3a7c0087082689655f971267aafbaf9b4432c37 Mon Sep 17 00:00:00 2001 From: Leonardo Cavallucci Date: Thu, 24 Aug 2023 17:42:19 +0200 Subject: [PATCH 2/4] Update CONTRIBUTING --- CONTRIBUTING.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 From b5c9f94f5bfbda0d6cc726a115c9db822368985d Mon Sep 17 00:00:00 2001 From: Leonardo Cavallucci Date: Mon, 11 Sep 2023 11:49:28 +0200 Subject: [PATCH 3/4] Fix readthedocs config --- .readthedocs.yml | 1 - 1 file changed, 1 deletion(-) 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 From 140d0b7bf7742df3cf917c2ac3ac78c7f05dc907 Mon Sep 17 00:00:00 2001 From: Leonardo Cavallucci Date: Tue, 12 Sep 2023 08:41:13 +0200 Subject: [PATCH 4/4] Restore deb fabric task --- tasks.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasks.py b/tasks.py index d987d76..d8c0510 100644 --- a/tasks.py +++ b/tasks.py @@ -143,3 +143,9 @@ def docserve(c): server.watch("CONTRIBUTING.rst", lambda: docbuild(c)) server.watch("docs/*.rst", lambda: docbuild(c)) server.serve(port=DOCS_PORT, root="_build/html") + + +@task +def deb(c): + """Build debian package.""" + c.run("debuild -us -uc -b")