Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ jobs:

- name: Release | Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@37a30a7987cfebb6d49240bf1c4e9cd9817d0673 # v10.6.0
uses: python-semantic-release/python-semantic-release@39dd2052f2ce8282a5d932c31d58a2ca06d2550e # v10.6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
verbosity: 1
build: false

- name: Release | Add distribution artifacts to GitHub Release Assets
uses: python-semantic-release/publish-action@4f3c5d7f5caddf6535050c4bcb55f033f000a7dd # v10.6.0
uses: python-semantic-release/publish-action@5a5718ce47b892ef699f2972dae122297771d641 # v10.6.1
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:

- name: Build | Build next version artifacts
id: version
uses: python-semantic-release/python-semantic-release@37a30a7987cfebb6d49240bf1c4e9cd9817d0673 # v10.6.0
uses: python-semantic-release/python-semantic-release@39dd2052f2ce8282a5d932c31d58a2ca06d2550e # v10.6.1
with:
github_token: ""
verbosity: 1
Expand Down
49 changes: 49 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,55 @@
CHANGELOG
=========

.. _changelog-v10.6.1:

v10.6.1 (2026-07-06)
====================

🪲 Bug Fixes
------------

* **changelog**: Fix handling of whitespace commit bodies in changelog template filter (`PR#1457`_,
`d95e46e`_)

* **cmd-version**: Fix non-styled error msg when strict & no new version, closes `#1423`_
(`PR#1437`_, `5e8f94c`_)

* **config**: Eliminate ``.git/`` in parent dir warnings for monorepos configured with ``..``,
closes `#1418`_ (`PR#1444`_, `7a1f822`_)

📖 Documentation
----------------

* **CHANGELOG**: Add ``v9.21.2`` changelog details for website (`a4115cf`_)

* **configuration**: Document ``repo_dir`` config option (`PR#1444`_, `7a1f822`_)

⚙️ Build System
----------------

* **deps**: Expand ``python-gitlab`` dependency range to include ``v8.0.0+`` (`PR#1451`_,
`a4b9a43`_)

* **deps**: Expand ``tomlkit`` dependency range to include ``v0.14.0+`` & ``v0.15.0+`` (`028d539`_)

* **deps**: Extend ``click`` dependency range to include ``v8.2+`` (`01707ea`_)

.. _#1418: https://github.com/python-semantic-release/python-semantic-release/issues/1418
.. _#1423: https://github.com/python-semantic-release/python-semantic-release/issues/1423
.. _01707ea: https://github.com/python-semantic-release/python-semantic-release/commit/01707ead53e093fe217a82c9ff9898c5e4daf9dc
.. _028d539: https://github.com/python-semantic-release/python-semantic-release/commit/028d53909276270ce969d246ed739afd7808eacd
.. _5e8f94c: https://github.com/python-semantic-release/python-semantic-release/commit/5e8f94c3d81ccf17598af8a77659dd31df2ea403
.. _7a1f822: https://github.com/python-semantic-release/python-semantic-release/commit/7a1f822c06f5258f8b82ea9563b56979d3bc1cd9
.. _a4115cf: https://github.com/python-semantic-release/python-semantic-release/commit/a4115cfe98b98598adc1b44e04565ec0254b604d
.. _a4b9a43: https://github.com/python-semantic-release/python-semantic-release/commit/a4b9a438846c9f795b8bbaf2b145077fb6c3f7a5
.. _d95e46e: https://github.com/python-semantic-release/python-semantic-release/commit/d95e46e7603b559c6de6160092c0b9af9a428f02
.. _PR#1437: https://github.com/python-semantic-release/python-semantic-release/pull/1437
.. _PR#1444: https://github.com/python-semantic-release/python-semantic-release/pull/1444
.. _PR#1451: https://github.com/python-semantic-release/python-semantic-release/pull/1451
.. _PR#1457: https://github.com/python-semantic-release/python-semantic-release/pull/1457


.. _changelog-v10.6.0:

v10.6.0 (2026-07-04)
Expand Down
4 changes: 2 additions & 2 deletions docs/configuration/automatic-releases/github-actions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -893,14 +893,14 @@ to the GitHub Release Assets as well.
- name: Action | Semantic Version Release
id: release
# Adjust tag with desired version if applicable.
uses: python-semantic-release/python-semantic-release@COMMIT_HASH # v10.6.0
uses: python-semantic-release/python-semantic-release@COMMIT_HASH # v10.6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
git_committer_name: "github-actions"
git_committer_email: "actions@users.noreply.github.com"

- name: Publish | Upload to GitHub Release Assets
uses: python-semantic-release/publish-action@COMMIT_HASH # v10.6.0
uses: python-semantic-release/publish-action@COMMIT_HASH # v10.6.1
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
95 changes: 57 additions & 38 deletions docs/configuration/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,52 @@ sure to use the correct root key depending on the configuration format you are u

----

.. _config-add_partial_tags:

``add_partial_tags``
""""""""""""""""""""

**Type:** ``bool``

Specify if partial version tags should be handled when creating a new version. If set to
``true``, a ``major`` and a ``major.minor`` tag will be created or updated, using the format
specified in :ref:`tag_format`. If version has build metadata, a ``major.minor.patch`` tag
will also be created or updated.

Partial version tags are **disabled** for pre-release versions.

**Example**

.. code-block:: toml

[semantic_release]
tag_format = "v{version}"
add_partial_tags = true

This configuration with the next version of ``1.2.3`` will result in:

.. code-block:: bash

git log --decorate --oneline --graph --all
# * 4d4cb0a (tag: v1.2.3, tag: v1.2, tag: v1, origin/main, main) 1.2.3
# * 3a2b1c0 fix: some bug
# * 2b1c0a9 (tag: v1.2.2) 1.2.2
# ...

If build-metadata is used, the next version of ``1.2.3+20251109`` will result in:

.. code-block:: bash

git log --decorate --oneline --graph --all
# * 4d4cb0a (tag: v1.2.3+20251109, tag: v1.2.3, tag: v1.2, tag: v1, origin/main, main) 1.2.3+20251109
# * 3a2b1c0 chore: add partial tags to PSR configuration
# * 2b1c0a9 (tag: v1.2.3+20251031) 1.2.3+20251031
# ...

**Default:** ``false``

----

.. _config-allow_zero_version:

``allow_zero_version``
Expand Down Expand Up @@ -1162,49 +1208,22 @@ from the :ref:`remote.name <config-remote-name>` location of your git repository

----

.. _config-add_partial_tags:

``add_partial_tags``
""""""""""""""""""""

**Type:** ``bool``

Specify if partial version tags should be handled when creating a new version. If set to
``true``, a ``major`` and a ``major.minor`` tag will be created or updated, using the format
specified in :ref:`tag_format`. If version has build metadata, a ``major.minor.patch`` tag
will also be created or updated.

Partial version tags are **disabled** for pre-release versions.
.. _config-repo_dir:

**Example**

.. code-block:: toml

[semantic_release]
tag_format = "v{version}"
add_partial_tags = true

This configuration with the next version of ``1.2.3`` will result in:

.. code-block:: bash

git log --decorate --oneline --graph --all
# * 4d4cb0a (tag: v1.2.3, tag: v1.2, tag: v1, origin/main, main) 1.2.3
# * 3a2b1c0 fix: some bug
# * 2b1c0a9 (tag: v1.2.2) 1.2.2
# ...
``repo_dir``
""""""""""""

If build-metadata is used, the next version of ``1.2.3+20251109`` will result in:
**Type:** ``str``

.. code-block:: bash
Specify the directory of the Git repository. This is used to determine the location of
the repository for various operations, such as creating tags and commits. PSR will attempt
to automatically determine the location of the repository in parent directories of the
current working directory but will emit a warning if it is higher than this defined value.

git log --decorate --oneline --graph --all
# * 4d4cb0a (tag: v1.2.3+20251109, tag: v1.2.3, tag: v1.2, tag: v1, origin/main, main) 1.2.3+20251109
# * 3a2b1c0 chore: add partial tags to PSR configuration
# * 2b1c0a9 (tag: v1.2.3+20251031) 1.2.3+20251031
# ...
If a git repository is not found from this location or any parent directories, PSR will
raise an error and exit.

**Default:** ``false``
**Default:** ``"."``

----

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "python-semantic-release"
version = "10.6.0"
version = "10.6.1"
description = "Automatic Semantic Versioning for Python projects"
requires-python = "~= 3.8"
license = { text = "MIT" }
Expand Down
2 changes: 1 addition & 1 deletion src/gh_action/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-semantic-release == 10.6.0
python-semantic-release == 10.6.1
28 changes: 20 additions & 8 deletions src/semantic_release/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@
error as RegExpError, # noqa: N812
escape as regex_escape,
)
from typing import Any, ClassVar, Dict, List, Literal, Optional, Tuple, Type, Union
from typing import (
Any,
ClassVar,
Dict,
List,
Literal,
Optional,
Tuple,
Type,
Union,
cast,
)

# typing_extensions is for Python 3.8, 3.9, 3.10 compatibility
import tomlkit
Expand Down Expand Up @@ -363,7 +374,7 @@ class RawConfig(BaseModel):
logging_use_named_masks: bool = False
major_on_zero: bool = True
allow_zero_version: bool = False
repo_dir: Annotated[Path, Field(validate_default=True)] = Path(".")
repo_dir: Path = Field(default=cast("Path", "."), validate_default=True)
remote: RemoteConfig = RemoteConfig()
no_git_verify: bool = False
tag_format: str = "v{version}"
Expand All @@ -388,18 +399,19 @@ def verify_git_repo_dir(cls, dir_path: Path) -> Path:
found_path = (
Path(git_repo.working_tree_dir or git_repo.working_dir)
.expanduser()
.resolve()
.absolute()
)

except InvalidGitRepositoryError as err:
raise InvalidGitRepositoryError("No valid git repository found!") from err
msg = "No valid git repository found!"
raise InvalidGitRepositoryError(msg) from err

if dir_path.absolute() != found_path:
logging.warning(
"Found .git/ in higher parent directory rather than provided in configuration."
)
if dir_path.resolve().absolute() != found_path:
msg = "Found .git/ in higher parent directory rather than provided in configuration."
logger.warning(msg)

return found_path.resolve()
return found_path

@field_validator("commit_parser", mode="after")
@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
repo_w_git_flow_emoji_commits,
repo_w_git_flow_scipy_commits,
)
from tests.util import temporary_working_directory
from tests.util import assert_str_not_in_output, temporary_working_directory

if TYPE_CHECKING:
from pathlib import Path
Expand Down Expand Up @@ -66,6 +66,7 @@ def test_gitflow_repo_rebuild_1_channel(
pyproject_toml_file: Path,
changelog_md_file: Path,
changelog_rst_file: Path,
caplog: pytest.LogCaptureFixture,
):
# build target repo into a temporary directory
target_repo_dir = example_project_dir / repo_fixture_name
Expand Down Expand Up @@ -153,6 +154,8 @@ def test_gitflow_repo_rebuild_1_channel(

# Evaluate (normal release actions should have occurred as expected)
# ------------------------------------------------------------------
# The warning should not be present in the logs since we are running in the same directory as the .git repo
assert_str_not_in_output("Found .git/ in higher parent directory", caplog.text)
# Make sure version file is updated
assert expected_pyproject_toml_content == actual_pyproject_toml_content
assert expected_version_file_content == actual_version_file_content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
repo_w_git_flow_w_alpha_prereleases_n_emoji_commits,
repo_w_git_flow_w_alpha_prereleases_n_scipy_commits,
)
from tests.util import temporary_working_directory
from tests.util import assert_str_not_in_output, temporary_working_directory

if TYPE_CHECKING:
from pathlib import Path
Expand Down Expand Up @@ -66,6 +66,7 @@ def test_gitflow_repo_rebuild_2_channels(
pyproject_toml_file: Path,
changelog_md_file: Path,
changelog_rst_file: Path,
caplog: pytest.LogCaptureFixture,
):
# build target repo into a temporary directory
target_repo_dir = example_project_dir / repo_fixture_name
Expand Down Expand Up @@ -153,6 +154,8 @@ def test_gitflow_repo_rebuild_2_channels(

# Evaluate (normal release actions should have occurred as expected)
# ------------------------------------------------------------------
# The warning should not be present in the logs since we are running in the same directory as the .git repo
assert_str_not_in_output("Found .git/ in higher parent directory", caplog.text)
# Make sure version file is updated
assert expected_pyproject_toml_content == actual_pyproject_toml_content
assert expected_version_file_content == actual_version_file_content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
repo_w_git_flow_w_rc_n_alpha_prereleases_n_emoji_commits,
repo_w_git_flow_w_rc_n_alpha_prereleases_n_scipy_commits,
)
from tests.util import temporary_working_directory
from tests.util import assert_str_not_in_output, temporary_working_directory

if TYPE_CHECKING:
from pathlib import Path
Expand Down Expand Up @@ -68,6 +68,7 @@ def test_gitflow_repo_rebuild_3_channels(
pyproject_toml_file: Path,
changelog_md_file: Path,
changelog_rst_file: Path,
caplog: pytest.LogCaptureFixture,
):
# build target repo into a temporary directory
target_repo_dir = example_project_dir / repo_fixture_name
Expand Down Expand Up @@ -154,6 +155,8 @@ def test_gitflow_repo_rebuild_3_channels(

# Evaluate (normal release actions should have occurred as expected)
# ------------------------------------------------------------------
# The warning should not be present in the logs since we are running in the same directory as the .git repo
assert_str_not_in_output("Found .git/ in higher parent directory", caplog.text)
# Make sure version file is updated
assert expected_pyproject_toml_content == actual_pyproject_toml_content
assert expected_version_file_content == actual_version_file_content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
repo_w_git_flow_w_beta_alpha_rev_prereleases_n_emoji_commits,
repo_w_git_flow_w_beta_alpha_rev_prereleases_n_scipy_commits,
)
from tests.util import temporary_working_directory
from tests.util import assert_str_not_in_output, temporary_working_directory

if TYPE_CHECKING:
from pathlib import Path
Expand Down Expand Up @@ -66,6 +66,7 @@ def test_gitflow_repo_rebuild_4_channels(
pyproject_toml_file: Path,
changelog_md_file: Path,
changelog_rst_file: Path,
caplog: pytest.LogCaptureFixture,
):
# build target repo into a temporary directory
target_repo_dir = example_project_dir / repo_fixture_name
Expand Down Expand Up @@ -153,6 +154,8 @@ def test_gitflow_repo_rebuild_4_channels(

# Evaluate (normal release actions should have occurred as expected)
# ------------------------------------------------------------------
# The warning should not be present in the logs since we are running in the same directory as the .git repo
assert_str_not_in_output("Found .git/ in higher parent directory", caplog.text)
# Make sure version file is updated
assert expected_pyproject_toml_content == actual_pyproject_toml_content
assert expected_version_file_content == actual_version_file_content
Expand Down
Loading
Loading