Repository: callowayproject/bump-my-version (python)

Issue:
always_increment value ignored when calver_format specified
bump-my-version: 1.1.2
Python version: 3.12.3
Platform: Linux, x86_64

## Scenario
CalVer-based format, with a patch component which can be incremented even after the date has changed (e.g. to patch a maintained older release).

```toml
[tool.bumpversion]
current_version = "22.49.0"
parse = '''
(?x)
(?P<release>
    (?:\d{1,3})\.   # YY (year)
    (?:\d{1,2})     # WW (week)
)\.
(?P<patch>\d+)      # patch
'''
serialize = ["{release}.{patch}"]

[tool.bumpversion.parts.release]
calver_format = '{YY}.{WW}'
always_increment = false
```

## Expected behaviour
Explicitly setting `always_increment = false` for a part with `calver_format` set would override the [default CalVer behaviour of setting `always_increment` to `true`]((https://callowayproject.github.io/bump-my-version/howtos/calver/#expected-behavior)).

e.g. if we are in week 19 of 2025, expect:
```shell
$ bump-my-version show-bump
22.49.0 ── bump ─┬─ release ─ 25.19.0
                 ╰─ patch ─── 22.49.1
```

## Actual behaviour
`always_increment` setting is ignored:

```shell
$ bump-my-version show-bump
22.49.0 ── bump ─┬─ release ─ 25.19.0
                 ╰─ patch ─── 25.19.0
```

```shell
$ bump-my-version show
[...]
 'parts': {'patch': {'always_increment': False,
                     'calver_format': None,
                     'depends_on': None,
                     'first_value': None,
                     'independent': False,
                     'optional_value': None,
                     'values': None},
           'release': {'always_increment': True,   <------------------------- manual setting ignored
                       'calver_format': '{YY}.{WW}',
                       'depends_on': None,
                       'first_value': None,
                       'independent': False,
                       'optional_value': None,
                       'values': None}},
[...]
```

Pull request:
Fixes for CalVer auto_increment behavior
If `auto_increment` is explicitly set, the value is kept. Otherwise, it is set to `True`.

Introduced new tests to verify CalVer component behavior with and without auto-increment enabled.

Fixes #345 

Patch:
diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml
index 3b4f0ef6..2b39562d 100644
--- a/.github/workflows/docs-preview.yml
+++ b/.github/workflows/docs-preview.yml
@@ -17,7 +17,7 @@ permissions:
 
 jobs:
   deploy-preview:
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-latest
     steps:
       - name: Checkout
         uses: actions/checkout@v4
diff --git a/.github/workflows/version-preview.yaml b/.github/workflows/version-preview.yaml
index e65a9abf..3a20af22 100644
--- a/.github/workflows/version-preview.yaml
+++ b/.github/workflows/version-preview.yaml
@@ -27,7 +27,7 @@ jobs:
       - name: Get the release hint
         id: generate-changelog
         run: |
-          RELEASE_KIND=$(generate-changelog --output release-hint --branch-override ${{ github.base_ref }} --skip-output-pipeline)
+          RELEASE_KIND=$(generate-changelog --output release-hint --branch-override ${{ github.base_ref }})
           echo "::notice::Suggested release type upon merge to ${{ github.base_ref }}: ${RELEASE_KIND}"
           echo "RELEASE_KIND=$RELEASE_KIND" >> $GITHUB_ENV
           echo "release-kind=$RELEASE_KIND" >> $GITHUB_OUTPUT
diff --git a/bumpversion/versioning/models.py b/bumpversion/versioning/models.py
index 9c7d9cb7..05c7232d 100644
--- a/bumpversion/versioning/models.py
+++ b/bumpversion/versioning/models.py
@@ -141,7 +141,7 @@ class VersionComponentSpec(BaseModel):
     @classmethod
     def set_always_increment_with_calver(cls, data: Any) -> Any:
         """Set always_increment to True if calver_format is present."""
-        if isinstance(data, dict) and data.get("calver_format"):
+        if isinstance(data, dict) and data.get("calver_format") and "always_increment" not in data:
             data["always_increment"] = True
         return data
 


Test patch:
diff --git a/tests/conftest.py b/tests/conftest.py
index 03b051a0..54ad4349 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -64,9 +64,21 @@ def get_semver(version: str) -> Version:
 @pytest.fixture
 def git_repo(tmp_path: Path) -> Path:
     """Generate a simple temporary git repo and return the path."""
-    subprocess.run(  # noqa: S603
+    subprocess.run(
         ["git", "init", "--initial-branch=main"], cwd=tmp_path, check=True, capture_output=True  # noqa: S607
     )
+    subprocess.run(
+        ["git", "config", "--local", "--type", "bool", "commit.gpgsign", "false"],  # noqa: S607
+        cwd=tmp_path,
+        check=True,
+        capture_output=True,
+    )
+    subprocess.run(
+        ["git", "config", "--local", "--type", "bool", "tag.gpgsign", "false"],  # noqa: S607
+        cwd=tmp_path,
+        check=True,
+        capture_output=True,
+    )
     return tmp_path
 
 
diff --git a/tests/test_versioning/test_models_version.py b/tests/test_versioning/test_models_version.py
index afd4a4e4..52952471 100644
--- a/tests/test_versioning/test_models_version.py
+++ b/tests/test_versioning/test_models_version.py
@@ -35,6 +35,18 @@ def calver_version_spec():
     return VersionSpec(config)
 
 
+@pytest.fixture
+def calver_version_spec_no_auto_increment():
+    """Return a calver version spec with `auto_increment` set to False."""
+    config = {
+        "release": VersionComponentSpec(calver_format="{YYYY}.{MM}.{DD}", always_increment=False),
+        "patch": VersionComponentSpec(),
+        "build": VersionComponentSpec(optional_value="0", independent=True),
+    }
+
+    return VersionSpec(config)
+
+
 class TestSemVerVersion:
     """Test how a SemVer-style Version model should behave."""
 
@@ -208,6 +220,36 @@ class TestCalVerVersion:
         with pytest.raises(KeyError):
             version["invalid"]
 
+    @freeze_time("2020-05-01")
+    def test_bump_alters_calver_by_default(self, calver_version_spec: VersionSpec):
+        """By default, the CalVer component should automatically increment."""
+        # Arrange
+        version = calver_version_spec.create_version({"release": "2020.4.1", "patch": "3", "build": "10"})
+
+        # Act
+        version = version.bump("patch")
+
+        # Assert
+        assert version["release"].value == "2020.5.1"
+        assert version["patch"].value == "0"
+        assert version["build"].value == "10"
+
+    @freeze_time("2020-05-01")
+    def test_auto_increment_false_does_not_increment(self, calver_version_spec_no_auto_increment: VersionSpec):
+        """If auto_increment is False, the CalVer component does not increment."""
+        # Arrange
+        version = calver_version_spec_no_auto_increment.create_version(
+            {"release": "2020.4.1", "patch": "3", "build": "10"}
+        )
+
+        # Act
+        version = version.bump("patch")
+
+        # Assert
+        assert version["release"].value == "2020.4.1"
+        assert version["patch"].value == "4"
+        assert version["build"].value == "10"
+
     def test_length_is_number_of_parts(self, calver_version_spec: VersionSpec):
         # Arrange
         version = calver_version_spec.create_version({"release": "2020.4.1"})
diff --git a/tests/test_versioning/test_models_versioncomponent.py b/tests/test_versioning/test_models_versioncomponent.py
index 67510661..307482d8 100644
--- a/tests/test_versioning/test_models_versioncomponent.py
+++ b/tests/test_versioning/test_models_versioncomponent.py
@@ -1,10 +1,10 @@
 """Tests of the VersionPart model."""
 
+import pytest
 from freezegun import freeze_time
 
+from bumpversion.versioning.functions import CalVerFunction, NumericFunction, ValuesFunction
 from bumpversion.versioning.models import VersionComponentSpec
-from bumpversion.versioning.functions import ValuesFunction, NumericFunction, CalVerFunction
-import pytest
 
 params = {
     "numeric": [{"optional_value": "0", "first_value": "0"}],
diff --git a/tests/test_versioning/test_models_versionspec.py b/tests/test_versioning/test_models_versionspec.py
index edcef5de..3ff2ff71 100644
--- a/tests/test_versioning/test_models_versionspec.py
+++ b/tests/test_versioning/test_models_versionspec.py
@@ -1,8 +1,8 @@
 """Tests of the VersionSpec model."""
 
 import pytest
-from bumpversion.versioning.models import VersionSpec
-from bumpversion.versioning.models import VersionComponentSpec
+
+from bumpversion.versioning.models import VersionComponentSpec, VersionSpec
 
 
 class TestVersionSpec: