From 1adb94ab21dcf94c9763bf846ee433af2762cad2 Mon Sep 17 00:00:00 2001 From: Dani Bodor Date: Mon, 24 Jun 2024 20:22:03 +0200 Subject: [PATCH] ci: use bump-my-version instead of bumpversion --- .bumpversion.cfg | 17 ----------------- .github/workflows/release_github.yml | 8 ++++---- README.dev.md | 2 +- pyproject.toml | 28 +++++++++++++++++++++++++++- 4 files changed, 32 insertions(+), 23 deletions(-) delete mode 100644 .bumpversion.cfg diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index d904fa168..000000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,17 +0,0 @@ -[bumpversion] -current_version = 1.0.2 - -[comment] -comment = The contents of this file cannot be merged with that of setup.cfg until https://github.com/c4urself/bump2version/issues/185 is resolved - -[bumpversion:file:eitprocessing/__init__.py] -search = __version__ = "{current_version}" -replace = __version__ = "{new_version}" - -[bumpversion:file:CITATION.cff] -search = version: "{current_version}" -replace = version: "{new_version}" - -[bumpversion:file:pyproject.toml] -search = version = "{current_version}" -replace = version = "{new_version}" diff --git a/.github/workflows/release_github.yml b/.github/workflows/release_github.yml index c8dda9e12..0c3b57a83 100644 --- a/.github/workflows/release_github.yml +++ b/.github/workflows/release_github.yml @@ -51,14 +51,14 @@ jobs: - name: Bump version id: bump run: | - echo "-- install bumpversion" - python3 -m pip install bumpversion + echo "-- install bump-my-version" + python3 -m pip install bump-my-version echo "-- merge release branch into main" git switch test_protected_main git merge ${{ github.event.inputs.release_branch }} echo "-- bump the version" - bumpversion ${{ github.event.inputs.version_level }} --commit --tag - echo "-- push bumpversion" + bump-my-version bump ${{ github.event.inputs.version_level }} --commit --tag + echo "-- push bumped version" echo "RELEASE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT git push --tags -f git push diff --git a/README.dev.md b/README.dev.md index 44bd53fbf..21f527574 100644 --- a/README.dev.md +++ b/README.dev.md @@ -180,7 +180,7 @@ NOTE: the current token (associated to @DaniBodor) allowing to bypass branch pro 1. Branch from `main` and prepare the branch for the release (e.g., removing the unnecessary files, fix minor bugs if necessary). 2. Ensure all tests pass `pytest -v` and that linting (`ruff check`) and formatting (`ruff format --check`) conventions are adhered to. -3. Bump the version using [bumpversion](https://github.com/c4urself/bump2version): `bumpversion ` +3. Bump the version using [bump-my-version](https://github.com/callowayproject/bump-my-version): `bump-my-version bump ` where level must be one of the following ([following semantic versioning conventions](https://semver.org/)): - `major`: when API-incompatible changes have been made - `minor`: when functionality was added in a backward compatible manner diff --git a/pyproject.toml b/pyproject.toml index dccc3743a..2860117ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ dependencies = [ # development dependency groups dev = [ "pytest >= 7.4.0", - "bump2version", + "bump-my-version", "coverage", "pycodestyle", "pytest-cov", @@ -165,3 +165,29 @@ isort.known-first-party = ["eitprocessing"] "PLR2004", # Comparison against unnamed value ] "docs/*" = ["ALL"] + +[tool.bumpversion] +current_version = "1.0.2" +parse = "(?P\\d+)\\.(?P\\d+)\\.(?P\\d+)" +serialize = ["{major}.{minor}.{patch}"] +search = "{current_version}" +replace = "{new_version}" +regex = false +ignore_missing_version = false +tag = false +sign_tags = false +tag_name = "v{new_version}" +tag_message = "Bump version: {current_version} → {new_version}" +allow_dirty = false +commit = false +message = "Bump version: {current_version} → {new_version}" +commit_args = "" + +[[tool.bumpversion.files]] +filename = "pyproject.toml" + +[[tool.bumpversion.files]] +filename = "CITATION.cff" + +[[tool.bumpversion.files]] +filename = "eitprocessing/__init__.py"