Repository: ClearcodeHQ/pytest-elasticsearch (language: python)

Issue:
Use tbump to manage releases



Discussion / hints:

Fix patch:
diff --git a/.bumpversion.cfg b/.bumpversion.cfg
deleted file mode 100644
index ecacb743..00000000
--- a/.bumpversion.cfg
+++ /dev/null
@@ -1,17 +0,0 @@
-[bumpversion]
-current_version = 3.0.0
-commit = True
-tag = True
-message = "Release {new_version}"
-
-[bumpversion:file:src/pytest_elasticsearch/__init__.py]
-
-[bumpversion:file:setup.cfg]
-search = version = {current_version}
-replace = version = {new_version}
-
-[bumpversion:file:CHANGES.rst]
-search = unreleased
-	----------
-replace = {new_version}
-	----------
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 95a87c6a..83ff8a2e 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -4,7 +4,7 @@ updates:
   directory: "/"
   schedule:
     interval: daily
-    time: "04:00"
+    time: "05:00"
   open-pull-requests-limit: 1
 - package-ecosystem: github-actions
   directory: "/"
diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml
index b880b5ee..121d2816 100644
--- a/.github/workflows/pr-check.yml
+++ b/.github/workflows/pr-check.yml
@@ -5,16 +5,16 @@ on:
     branches: [ main ]
 
 jobs:
-#  bump:
-#    runs-on: ubuntu-latest
-#    steps:
-#      - name: Check out repository
-#        uses: actions/checkout@v3
-#      - uses: fizyk/actions-reuse/.github/actions/pipenv@v2.2.1
-#        with:
-#          python-version: "3.11"
-#          pipenv-install-options: "--skip-lock"
-#          command: tbump --dry-run --only-patch $(pipenv run tbump current-version)"-x"
+  bump:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check out repository
+        uses: actions/checkout@v3
+      - uses: fizyk/actions-reuse/.github/actions/pipenv@v2.2.1
+        with:
+          python-version: "3.11"
+          pipenv-install-options: "--skip-lock"
+          command: tbump --dry-run --only-patch $(pipenv run tbump current-version)"-x"
   towncrier:
     runs-on: ubuntu-latest
     if: ${{ github.actor != 'dependabot[bot]' }}
diff --git a/Pipfile b/Pipfile
index 6b4ad0b3..e0f24fe9 100644
--- a/Pipfile
+++ b/Pipfile
@@ -19,3 +19,4 @@ ruff = "==0.0.272"
 types-setuptools = "==68.0.0.3"
 mypy = "==1.4.1"
 types-mock = "==5.1.0.1"
+tbump = "==6.10.0"
diff --git a/Pipfile.lock b/Pipfile.lock
index b491edbd..e42857af 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "69760cb6d130f0080a6dceacebdc231ad1084e8449f4d008ab635d70b06478c7"
+            "sha256": "10af4e8a6968501c6493c0f023054e805268c32a0651b0f7bce76d1afafc1516"
         },
         "pipfile-spec": 6,
         "requires": {},
@@ -147,6 +147,14 @@
             "index": "pypi",
             "version": "==23.3.0"
         },
+        "cli-ui": {
+            "hashes": [
+                "sha256:2f67e50cf474e76ad160c3e660bbad98bf8b8dfb8d847765f3a261b7e13c05fa",
+                "sha256:6a1ebdbbcd83a0fa06b2f63f4434082a3ba8664aebedd91f1ff86b9e4289d53e"
+            ],
+            "markers": "python_version >= '3.7' and python_version < '4.0'",
+            "version": "==0.17.2"
+        },
         "click": {
             "hashes": [
                 "sha256:48ee849951919527a045bfe3bf7baa8a959c423134e1a5b98c05c20ba75a1cbd",
@@ -161,6 +169,22 @@
             ],
             "version": "==1.2.2"
         },
+        "colorama": {
+            "hashes": [
+                "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44",
+                "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"
+            ],
+            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'",
+            "version": "==0.4.6"
+        },
+        "contextlib2": {
+            "hashes": [
+                "sha256:3fbdb64466afd23abaf6c977627b75b6139a5a3e8ce38405c5b413aed7a0471f",
+                "sha256:ab1e2bfe1d01d968e1b7e8d9023bc51ef3509bba217bb730cee3827e1ee82869"
+            ],
+            "markers": "python_version >= '3.6'",
+            "version": "==21.6.0"
+        },
         "coverage": {
             "extras": [
                 "toml"
@@ -230,6 +254,12 @@
             "markers": "python_version >= '3.7'",
             "version": "==7.2.7"
         },
+        "docopt": {
+            "hashes": [
+                "sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491"
+            ],
+            "version": "==0.6.2"
+        },
         "execnet": {
             "hashes": [
                 "sha256:88256416ae766bc9e8895c76a87928c0012183da3cc4fc18016e6f050e025f41",
@@ -444,6 +474,38 @@
             "index": "pypi",
             "version": "==0.0.272"
         },
+        "schema": {
+            "hashes": [
+                "sha256:f06717112c61895cabc4707752b88716e8420a8819d71404501e114f91043197",
+                "sha256:f3ffdeeada09ec34bf40d7d79996d9f7175db93b7a5065de0faa7f41083c1e6c"
+            ],
+            "version": "==0.7.5"
+        },
+        "tabulate": {
+            "hashes": [
+                "sha256:0ba055423dbaa164b9e456abe7920c5e8ed33fcc16f6d1b2f2d152c8e1e8b4fc",
+                "sha256:436f1c768b424654fce8597290d2764def1eea6a77cfa5c33be00b1bc0f4f63d",
+                "sha256:6c57f3f3dd7ac2782770155f3adb2db0b1a269637e42f27599925e64b114f519"
+            ],
+            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
+            "version": "==0.8.10"
+        },
+        "tbump": {
+            "hashes": [
+                "sha256:170a4395d167daee357cb96af5e874119c470feaba9f605e73f3426e768c2542",
+                "sha256:9ebf5d69bc92ca8be1afb13a80f51e374526cb9988f4c3b167036a9e8a10a684"
+            ],
+            "index": "pypi",
+            "version": "==6.10.0"
+        },
+        "tomlkit": {
+            "hashes": [
+                "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171",
+                "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3"
+            ],
+            "markers": "python_version >= '3.7'",
+            "version": "==0.11.8"
+        },
         "towncrier": {
             "hashes": [
                 "sha256:da552f29192b3c2b04d630133f194c98e9f14f0558669d427708e203fea4d0a5",
@@ -475,6 +537,14 @@
             ],
             "markers": "python_version >= '3.7'",
             "version": "==4.7.1"
+        },
+        "unidecode": {
+            "hashes": [
+                "sha256:547d7c479e4f377b430dd91ac1275d593308dce0fc464fb2ab7d41f82ec653be",
+                "sha256:fed09cf0be8cf415b391642c2a5addfc72194407caee4f98719e40ec2a72b830"
+            ],
+            "markers": "python_version >= '3.5'",
+            "version": "==1.3.6"
         }
     }
 }
diff --git a/newsfragments/476.misc.rst b/newsfragments/476.misc.rst
new file mode 100644
index 00000000..eeddd31a
--- /dev/null
+++ b/newsfragments/476.misc.rst
@@ -0,0 +1,1 @@
+Replace bumpversion with tbump to manage versioning
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index 00f4cf07..1e2e1ada 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -78,7 +78,7 @@ select = [
 directory = "newsfragments"
 single_file=true
 filename="CHANGES.rst"
-issue_format="`#{issue} <https://github.com/ClearcodeHQ/pytest-elasticsearch/issues/{issue}>`_"
+issue_format="`#{issue} <https://github.com/ClearcodeHQ/pytest-elasticsearch/issues/{issue}>`__"
 
 [[tool.towncrier.type]]
 directory = "break"
@@ -106,4 +106,56 @@ name = "Miscellaneus"
 showcontent = false
 
 [tool.tbump.version]
-current = "3.0.0"
\ No newline at end of file
+current = "3.0.0"
+
+# Example of a semver regexp.
+# Make sure this matches current_version before
+# using tbump
+regex = '''
+  (?P<major>\d+)
+  \.
+  (?P<minor>\d+)
+  \.
+  (?P<patch>\d+)
+  (\-
+    (?P<extra>.+)
+  )?
+  '''
+
+[tool.tbump.git]
+message_template = "Release {new_version}"
+tag_template = "v{new_version}"
+
+[[tool.tbump.field]]
+# the name of the field
+name = "extra"
+# the default value to use, if there is no match
+default = ""
+# For each file to patch, add a [[file]] config
+# section containing the path of the file, relative to the
+# tbump.toml location.
+
+[[tool.tbump.file]]
+src = "pytest_elasticsearch/__init__.py"
+
+[[tool.tbump.file]]
+src = "pyproject.toml"
+search = 'version = "{current_version}"'
+
+[[tool.tbump.file]]
+src = "pyproject.toml"
+search = '"Changelog" = "https://github.com/ClearcodeHQ/pytest-elasticsearch/blob/v{current_version}/CHANGES.rst"'
+
+# You can specify a list of commands to
+# run after the files have been patched
+# and before the git commit is made
+
+[[tool.tbump.before_commit]]
+name = "Build changelog"
+cmd = "pipenv run towncrier build --version {new_version} --yes"
+
+# Or run some commands after the git tag and the branch
+# have been pushed:
+#  [[tool.tbump.after_push]]
+#  name = "publish"
+#  cmd = "./publish.sh"
\ No newline at end of file


Test patch:
diff --git a/.github/actions/pytest/action.yml b/.github/actions/pytest/action.yml
index 2239975e..d6d5c2dd 100644
--- a/.github/actions/pytest/action.yml
+++ b/.github/actions/pytest/action.yml
@@ -23,13 +23,13 @@ runs:
     with:
       elasticsearch-version: ${{ inputs.elasticsearch }}
   - name: Run test
-    uses: fizyk/actions-reuse/.github/actions/pipenv@v2.1.2
+    uses: fizyk/actions-reuse/.github/actions/pipenv@v2.2.1
     with:
       python-version: ${{ matrix.python-version }}
       pipenv-install-options: "--skip-lock"
       command: pytest --elasticsearch-executable=$ES_HOME/bin/elasticsearch -n 0 --cov-report=xml
   - name: Run xdist test
-    uses: fizyk/actions-reuse/.github/actions/pipenv@v2.1.2
+    uses: fizyk/actions-reuse/.github/actions/pipenv@v2.2.1
     with:
       python-version: ${{ matrix.python-version }}
       pipenv-install-options: "--skip-lock"