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@02f2a5c74dbb6aa2989f10fc4af12cd8e6bf025f # v10.5.2
uses: python-semantic-release/python-semantic-release@350c48fcb3ffcdfd2e0a235206bc2ecea6b69df0 # v10.5.3
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@948bb8fccc5e8072f2c52464b45c76a8bb3878e6 # v10.5.2
uses: python-semantic-release/publish-action@310a9983a0ae878b29f3aac778d7c77c1db27378 # v10.5.3
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@02f2a5c74dbb6aa2989f10fc4af12cd8e6bf025f # v10.5.2
uses: python-semantic-release/python-semantic-release@350c48fcb3ffcdfd2e0a235206bc2ecea6b69df0 # v10.5.3
with:
github_token: ""
verbosity: 1
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,34 @@
CHANGELOG
=========

.. _changelog-v10.5.3:

v10.5.3 (2025-12-14)
====================

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

* **cmd-version**: Resolve unauthenticated git repo issues for upstream verification, closes
`#1373`_ (`PR#1388`_, `e164f68`_)

* **github-action**: Fix failed signing issue when ssh was missing from action environment, closes
`#1376`_ (`PR#1389`_, `18b7eda`_)

* **parser-conventional-monorepo**: Fix parser opts validator for outside dir path matches, closes
`#1380`_ (`PR#1382`_, `a51eadd`_)

.. _#1373: https://github.com/python-semantic-release/python-semantic-release/issues/1373
.. _#1376: https://github.com/python-semantic-release/python-semantic-release/issues/1376
.. _#1380: https://github.com/python-semantic-release/python-semantic-release/issues/1380
.. _18b7eda: https://github.com/python-semantic-release/python-semantic-release/commit/18b7edadd7e7dfe42ec43110acf5e1bd8bcd7eb3
.. _a51eadd: https://github.com/python-semantic-release/python-semantic-release/commit/a51eadd8414a7e9cbfa66837ee5a840a6331dfa1
.. _e164f68: https://github.com/python-semantic-release/python-semantic-release/commit/e164f682bfa4ca1e7cbe77aa068202fd8094eec7
.. _PR#1382: https://github.com/python-semantic-release/python-semantic-release/pull/1382
.. _PR#1388: https://github.com/python-semantic-release/python-semantic-release/pull/1388
.. _PR#1389: https://github.com/python-semantic-release/python-semantic-release/pull/1389


.. _changelog-v10.5.2:

v10.5.2 (2025-11-10)
Expand Down
14 changes: 7 additions & 7 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/[email protected].2
uses: python-semantic-release/[email protected].3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
git_committer_name: "github-actions"
git_committer_email: "[email protected]"

- name: Publish | Upload to GitHub Release Assets
uses: python-semantic-release/[email protected].2
uses: python-semantic-release/[email protected].3
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -1005,7 +1005,7 @@ The equivalent GitHub Action configuration would be:

- name: Action | Semantic Version Release
# Adjust tag with desired version if applicable.
uses: python-semantic-release/[email protected].2
uses: python-semantic-release/[email protected].3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: patch
Expand Down Expand Up @@ -1064,14 +1064,14 @@ Publish Action.

- name: Release submodule 1
id: release-submod-1
uses: python-semantic-release/[email protected].2
uses: python-semantic-release/[email protected].3
with:
directory: ${{ env.SUBMODULE_1_DIR }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Release submodule 2
id: release-submod-2
uses: python-semantic-release/[email protected].2
uses: python-semantic-release/[email protected].3
with:
directory: ${{ env.SUBMODULE_2_DIR }}
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -1083,15 +1083,15 @@ Publish Action.
# ------------------------------------------------------------------- #

- name: Publish | Upload package 1 to GitHub Release Assets
uses: python-semantic-release/[email protected].2
uses: python-semantic-release/[email protected].3
if: steps.release-submod-1.outputs.released == 'true'
with:
directory: ${{ env.SUBMODULE_1_DIR }}
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release-submod-1.outputs.tag }}

- name: Publish | Upload package 2 to GitHub Release Assets
uses: python-semantic-release/[email protected].2
uses: python-semantic-release/[email protected].3
if: steps.release-submod-2.outputs.released == 'true'
with:
directory: ${{ env.SUBMODULE_2_DIR }}
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.5.2"
version = "10.5.3"
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.5.2
python-semantic-release == 10.5.3
43 changes: 26 additions & 17 deletions src/semantic_release/commit_parser/conventional/options_monorepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,37 +43,46 @@ class ConventionalCommitMonorepoParserOptions(ConventionalCommitParserOptions):
to match them literally.
"""

@classmethod
@field_validator("path_filters", mode="before")
def convert_strs_to_paths(cls, value: Any) -> tuple[Path, ...]:
values = value if isinstance(value, Iterable) else [value]
results: list[Path] = []
@classmethod
def convert_strs_to_paths(cls, value: Any) -> tuple[str, ...]:
if isinstance(value, str):
return (value,)

for val in values:
if isinstance(val, (str, Path)):
results.append(Path(val))
continue
if isinstance(value, Path):
return (str(value),)

raise TypeError(f"Invalid type: {type(val)}, expected str or Path.")
if isinstance(value, Iterable):
results: list[str] = []
for val in value:
if isinstance(val, (str, Path)):
results.append(str(Path(val)))
continue

return tuple(results)
msg = f"Invalid type: {type(val)}, expected str or Path."
raise TypeError(msg)

return tuple(results)

msg = f"Invalid type: {type(value)}, expected str, Path, or Iterable."
raise TypeError(msg)

@classmethod
@field_validator("path_filters", mode="after")
def resolve_path(cls, dir_paths: tuple[Path, ...]) -> tuple[Path, ...]:
@classmethod
def resolve_path(cls, dir_path_strs: tuple[str, ...]) -> tuple[str, ...]:
return tuple(
(
Path(f"!{Path(str_path[1:]).expanduser().absolute().resolve()}")
f"!{Path(str_path[1:]).expanduser().absolute().resolve()}"
# maintains the negation prefix if it exists
if (str_path := str(path)).startswith("!")
if str_path.startswith("!")
# otherwise, resolve the path normally
else path.expanduser().absolute().resolve()
else str(Path(str_path).expanduser().absolute().resolve())
)
for path in dir_paths
for str_path in dir_path_strs
)

@classmethod
@field_validator("scope_prefix", mode="after")
@classmethod
def validate_scope_prefix(cls, scope_prefix: str) -> str:
if not scope_prefix:
return ""
Expand Down
52 changes: 16 additions & 36 deletions tests/fixtures/git_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class CommitDef(TypedDict):
sha: str
datetime: NotRequired[DatetimeISOStr]
include_in_changelog: bool
file_to_change: NotRequired[Path | str]

class BaseRepoVersionDef(TypedDict):
"""A Common Repo definition for a get_commits_repo_*() fixture with all commit convention types"""
Expand Down Expand Up @@ -290,6 +291,7 @@ class CommitSpec(TypedDict):
scipy: str
datetime: NotRequired[DatetimeISOStr]
include_in_changelog: NotRequired[bool]
file_to_change: NotRequired[Path | str]

class DetailsBase(TypedDict):
pre_actions: NotRequired[Sequence[RepoActions]]
Expand Down Expand Up @@ -1127,7 +1129,9 @@ def _simulate_change_commits_n_rtn_changelog_entry(
changelog_entries: list[CommitDef] = []
for commit_msg in commit_msgs:
if not git_repo.is_dirty(index=True, working_tree=False):
add_text_to_file(git_repo, file_in_repo)
add_text_to_file(
git_repo, str(commit_msg.get("file_to_change", file_in_repo))
)

changelog_entries.append(commit_n_rtn_changelog_entry(git_repo, commit_msg))

Expand Down Expand Up @@ -1336,39 +1340,6 @@ def _configure_base_repo( # noqa: C901

@pytest.fixture(scope="session")
def separate_squashed_commit_def() -> SeparateSquashedCommitDefFn:
# default_conventional_parser: ConventionalCommitParser,
# default_emoji_parser: EmojiCommitParser,
# default_scipy_parser: ScipyCommitParser,
# message_parsers: dict[
# CommitConvention,
# ConventionalCommitParser | EmojiCommitParser | ScipyCommitParser,
# ] = {
# "conventional": ConventionalCommitParser(
# options=ConventionalCommitParserOptions(
# **{
# **default_conventional_parser.options.__dict__,
# "parse_squash_commits": True,
# }
# )
# ),
# "emoji": EmojiCommitParser(
# options=EmojiParserOptions(
# **{
# **default_emoji_parser.options.__dict__,
# "parse_squash_commits": True,
# }
# )
# ),
# "scipy": ScipyCommitParser(
# options=ScipyParserOptions(
# **{
# **default_scipy_parser.options.__dict__,
# "parse_squash_commits": True,
# }
# )
# ),
# }

def _separate_squashed_commit_def(
squashed_commit_def: CommitDef,
parser: SquashedCommitSupportedParser,
Expand Down Expand Up @@ -1435,17 +1406,26 @@ def _convert(
)

# Extract the correct commit message for the commit type
return {
commit_def: CommitDef = {
**parse_msg_fn(commit_spec[commit_type], parser=parser),
"cid": commit_spec["cid"],
"datetime": (
commit_spec["datetime"]
if "datetime" in commit_spec
else stable_now_date.isoformat(timespec="seconds")
),
"include_in_changelog": (commit_spec.get("include_in_changelog", True)),
"include_in_changelog": commit_spec.get("include_in_changelog", True),
}

if "file_to_change" in commit_spec:
commit_def.update(
{
"file_to_change": commit_spec["file_to_change"],
}
)

return commit_def

return _convert


Expand Down
44 changes: 42 additions & 2 deletions tests/fixtures/monorepos/example_monorepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ def build_spec_hash_4_example_monorepo(
@pytest.fixture(scope="session")
def cached_example_monorepo(
build_repo_or_copy_cache: BuildRepoOrCopyCacheFn,
monorepo_pkg1_dir: Path,
monorepo_pkg2_dir: Path,
monorepo_pkg1_name: str,
monorepo_pkg2_name: str,
monorepo_pkg1_dir: str,
monorepo_pkg2_dir: str,
monorepo_pkg1_docs_dir: str,
monorepo_pkg2_docs_dir: str,
monorepo_pkg1_version_py_file: Path,
monorepo_pkg2_version_py_file: Path,
monorepo_pkg1_pyproject_toml_file: Path,
Expand Down Expand Up @@ -104,6 +108,13 @@ def hello_world() -> None:
print("{pkg_name} Hello World")
'''
).lstrip()
doc_index_contents = dedent(
"""
==================
{pkg_name} Documentation
==================
"""
).lstrip()

with temporary_working_directory(cached_project_path):
update_version_py_file(
Expand All @@ -127,6 +138,14 @@ def hello_world() -> None:
(".gitignore", gitignore_contents),
(monorepo_pkg1_pyproject_toml_file, EXAMPLE_PYPROJECT_TOML_CONTENT),
(monorepo_pkg2_pyproject_toml_file, EXAMPLE_PYPROJECT_TOML_CONTENT),
(
Path(monorepo_pkg1_docs_dir, "index.rst"),
doc_index_contents.format(pkg_name=monorepo_pkg1_name),
),
(
Path(monorepo_pkg2_docs_dir, "index.rst"),
doc_index_contents.format(pkg_name=monorepo_pkg2_name),
),
]

for file, contents in file_2_contents:
Expand Down Expand Up @@ -216,6 +235,27 @@ def monorepo_pkg2_name() -> str:
return "pkg2"


@pytest.fixture(scope="session")
def monorepo_pkg_docs_dir_pattern() -> str:
return str(Path("docs", "source", "{package_name}"))


@pytest.fixture(scope="session")
def monorepo_pkg1_docs_dir(
monorepo_pkg1_name: str,
monorepo_pkg_docs_dir_pattern: str,
) -> str:
return monorepo_pkg_docs_dir_pattern.format(package_name=monorepo_pkg1_name)


@pytest.fixture(scope="session")
def monorepo_pkg2_docs_dir(
monorepo_pkg2_name: str,
monorepo_pkg_docs_dir_pattern: str,
) -> str:
return monorepo_pkg_docs_dir_pattern.format(package_name=monorepo_pkg2_name)


@pytest.fixture(scope="session")
def monorepo_pkg_dir_pattern() -> str:
return str(Path("packages", "{package_name}"))
Expand Down
Loading
Loading