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
32 changes: 2 additions & 30 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,49 +140,21 @@ jobs:
python -m scripts.bump_version_in_docs
git add docs/*

- name: Evaluate | Verify upstream has NOT changed
# Last chance to abort before causing an error as another PR/push was applied to the upstream branch
# while this workflow was running. This is important because we are committing a version change
shell: bash
run: bash .github/workflows/verify_upstream.sh

- name: Release | Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@4d4cb0ab842247caea1963132c242c62aab1e4d5 # v10.4.1
uses: python-semantic-release/python-semantic-release@02f2a5c74dbb6aa2989f10fc4af12cd8e6bf025f # v10.5.2
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@ae6462adc12bd3d1738070d784b65b5189b955a9 # v10.4.1
uses: python-semantic-release/publish-action@948bb8fccc5e8072f2c52464b45c76a8bb3878e6 # v10.5.2
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}

- name: Release | Update Minor Release Tag Reference
if: steps.release.outputs.released == 'true' && steps.release.outputs.is_prerelease == 'false'
env:
FULL_VERSION_TAG: ${{ steps.release.outputs.tag }}
GIT_COMMITTER_NAME: ${{ env.GITHUB_ACTIONS_AUTHOR_NAME }}
GIT_COMMITTER_EMAIL: ${{ env.GITHUB_ACTIONS_AUTHOR_EMAIL }}
run: |
MINOR_VERSION_TAG="$(echo "$FULL_VERSION_TAG" | cut -d. -f1,2)"
git tag --force --annotate "$MINOR_VERSION_TAG" "${FULL_VERSION_TAG}^{}" -m "$MINOR_VERSION_TAG"
git push -u origin "$MINOR_VERSION_TAG" --force

- name: Release | Update Major Release Tag Reference
if: steps.release.outputs.released == 'true' && steps.release.outputs.is_prerelease == 'false'
env:
FULL_VERSION_TAG: ${{ steps.release.outputs.tag }}
GIT_COMMITTER_NAME: ${{ env.GITHUB_ACTIONS_AUTHOR_NAME }}
GIT_COMMITTER_EMAIL: ${{ env.GITHUB_ACTIONS_AUTHOR_EMAIL }}
run: |
MAJOR_VERSION_TAG="$(echo "$FULL_VERSION_TAG" | cut -d. -f1)"
git tag --force --annotate "$MAJOR_VERSION_TAG" "${FULL_VERSION_TAG}^{}" -m "$MAJOR_VERSION_TAG"
git push -u origin "$MAJOR_VERSION_TAG" --force

outputs:
released: ${{ steps.release.outputs.released || 'false' }}
new-release-version: ${{ steps.release.outputs.version }}
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@4d4cb0ab842247caea1963132c242c62aab1e4d5 # v10.4.1
uses: python-semantic-release/python-semantic-release@02f2a5c74dbb6aa2989f10fc4af12cd8e6bf025f # v10.5.2
with:
github_token: ""
verbosity: 1
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/verify_upstream.sh

This file was deleted.

15 changes: 15 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@
CHANGELOG
=========

.. _changelog-v10.5.2:

v10.5.2 (2025-11-10)
====================

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

* **cmd-version**: Toggle verify upstream off when no version commit is made (`PR#1370`_,
`e0b3b70`_)

.. _e0b3b70: https://github.com/python-semantic-release/python-semantic-release/commit/e0b3b7075a4c98cd7af97e0b8470872c11e7aeb9
.. _PR#1370: https://github.com/python-semantic-release/python-semantic-release/pull/1370


.. _changelog-v10.5.1:

v10.5.1 (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/python-semantic-release@v10.5.1
uses: python-semantic-release/python-semantic-release@v10.5.2
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@v10.5.1
uses: python-semantic-release/publish-action@v10.5.2
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/python-semantic-release@v10.5.1
uses: python-semantic-release/python-semantic-release@v10.5.2
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/python-semantic-release@v10.5.1
uses: python-semantic-release/python-semantic-release@v10.5.2
with:
directory: ${{ env.SUBMODULE_1_DIR }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Release submodule 2
id: release-submod-2
uses: python-semantic-release/python-semantic-release@v10.5.1
uses: python-semantic-release/python-semantic-release@v10.5.2
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/publish-action@v10.5.1
uses: python-semantic-release/publish-action@v10.5.2
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/publish-action@v10.5.1
uses: python-semantic-release/publish-action@v10.5.2
if: steps.release-submod-2.outputs.released == 'true'
with:
directory: ${{ env.SUBMODULE_2_DIR }}
Expand Down
3 changes: 2 additions & 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.1"
version = "10.5.2"
description = "Automatic Semantic Versioning for Python projects"
requires-python = "~= 3.8"
license = { text = "MIT" }
Expand Down Expand Up @@ -409,6 +409,7 @@ sections = { "tests" = ["tests"] }
ignore_names = ["change_to_ex_proj_dir", "init_example_project"]

[tool.semantic_release]
add_partial_tags = true
logging_use_named_masks = true
commit_parser = "conventional"
commit_parser_options = { parse_squash_commits = true, ignore_merge_commits = true }
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.1
python-semantic-release == 10.5.2
1 change: 1 addition & 0 deletions src/semantic_release/cli/commands/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ def version( # noqa: C901
)
except GitCommitEmptyIndexError:
logger.info("No local changes to add to any commit, skipping")
commit_changes = False

# Tag the version after potentially creating a new HEAD commit.
# This way if no source code is modified, i.e. all metadata updates
Expand Down
10 changes: 9 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,22 @@ def _run_cli(
invoke_kwargs: dict[str, Any] | None = None,
) -> Result:
from semantic_release.cli.commands.main import main
from semantic_release.globals import logger

# Prevent logs from being propagated to the root logger (pytest)
logger.propagate = False

cli_runner = CliRunner(mix_stderr=False)
env_vars = {**clean_os_environment, **(env or {})}
args = ["-vv", *(argv or [])]

with mock.patch.dict(os.environ, env_vars, clear=True):
# run the CLI with the provided arguments
return cli_runner.invoke(main, args=args, **(invoke_kwargs or {}))
result = cli_runner.invoke(main, args=args, **(invoke_kwargs or {}))
# Force the output to be printed to stdout which will be captured by pytest
sys.stdout.write(result.stdout)
sys.stderr.write(result.stderr)
return result

return _run_cli

Expand Down
27 changes: 2 additions & 25 deletions tests/e2e/cmd_version/test_version_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def test_version_print_next_version(
next_release_version: str,
file_in_repo: str,
run_cli: RunCliFn,
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
):
Expand Down Expand Up @@ -270,7 +269,6 @@ def test_version_print_tag_prints_next_tag(
get_cfg_value_from_def: GetCfgValueFromDefFn,
file_in_repo: str,
run_cli: RunCliFn,
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
):
Expand Down Expand Up @@ -386,7 +384,6 @@ def test_version_print_tag_prints_next_tag_no_zero_versions(
get_cfg_value_from_def: GetCfgValueFromDefFn,
file_in_repo: str,
run_cli: RunCliFn,
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
):
Expand Down Expand Up @@ -450,7 +447,6 @@ def test_version_print_last_released_prints_version(
repo_result: BuiltRepoResult,
get_versions_from_repo_build_def: GetVersionsFromRepoBuildDefFn,
run_cli: RunCliFn,
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
strip_logging_messages: StripLoggingMessagesFn,
Expand Down Expand Up @@ -502,7 +498,6 @@ def test_version_print_last_released_prints_released_if_commits(
get_versions_from_repo_build_def: GetVersionsFromRepoBuildDefFn,
commits: list[str],
run_cli: RunCliFn,
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
file_in_repo: str,
Expand Down Expand Up @@ -552,10 +547,8 @@ def test_version_print_last_released_prints_released_if_commits(
def test_version_print_last_released_prints_nothing_if_no_tags(
repo_result: BuiltRepoResult,
run_cli: RunCliFn,
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
caplog: pytest.LogCaptureFixture,
):
repo = repo_result["repo"]

Expand All @@ -577,10 +570,7 @@ def test_version_print_last_released_prints_nothing_if_no_tags(
# Evaluate (no release actions should have occurred on print)
assert_successful_exit_code(result, cli_cmd)
assert result.stdout == ""

# must use capture log to see this, because we use the logger to print this message
# not click's output
assert "No release tags found." in caplog.text
assert "No release tags found." in result.stderr

# assert nothing else happened (no code changes, no commit, no tag, no push, no vcs release)
assert repo_status_before == repo_status_after
Expand All @@ -598,7 +588,6 @@ def test_version_print_last_released_on_detached_head(
repo_result: BuiltRepoResult,
get_versions_from_repo_build_def: GetVersionsFromRepoBuildDefFn,
run_cli: RunCliFn,
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
strip_logging_messages: StripLoggingMessagesFn,
Expand Down Expand Up @@ -647,7 +636,6 @@ def test_version_print_last_released_on_nonrelease_branch(
repo_result: BuiltRepoResult,
get_versions_from_repo_build_def: GetVersionsFromRepoBuildDefFn,
run_cli: RunCliFn,
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
strip_logging_messages: StripLoggingMessagesFn,
Expand Down Expand Up @@ -705,7 +693,6 @@ def test_version_print_last_released_tag_prints_correct_tag(
get_cfg_value_from_def: GetCfgValueFromDefFn,
get_versions_from_repo_build_def: GetVersionsFromRepoBuildDefFn,
run_cli: RunCliFn,
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
strip_logging_messages: StripLoggingMessagesFn,
Expand Down Expand Up @@ -766,7 +753,6 @@ def test_version_print_last_released_tag_prints_released_if_commits(
get_versions_from_repo_build_def: GetVersionsFromRepoBuildDefFn,
commits: list[str],
run_cli: RunCliFn,
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
file_in_repo: str,
Expand Down Expand Up @@ -817,10 +803,8 @@ def test_version_print_last_released_tag_prints_released_if_commits(
def test_version_print_last_released_tag_prints_nothing_if_no_tags(
repo_result: BuiltRepoResult,
run_cli: RunCliFn,
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
caplog: pytest.LogCaptureFixture,
):
repo = repo_result["repo"]

Expand All @@ -842,10 +826,7 @@ def test_version_print_last_released_tag_prints_nothing_if_no_tags(
# Evaluate (no release actions should have occurred on print)
assert_successful_exit_code(result, cli_cmd)
assert result.stdout == ""

# must use capture log to see this, because we use the logger to print this message
# not click's output
assert "No release tags found." in caplog.text
assert "No release tags found." in result.stderr

# assert nothing else happened (no code changes, no commit, no tag, no push, no vcs release)
assert repo_status_before == repo_status_after
Expand All @@ -872,7 +853,6 @@ def test_version_print_last_released_tag_on_detached_head(
get_cfg_value_from_def: GetCfgValueFromDefFn,
get_versions_from_repo_build_def: GetVersionsFromRepoBuildDefFn,
run_cli: RunCliFn,
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
strip_logging_messages: StripLoggingMessagesFn,
Expand Down Expand Up @@ -931,7 +911,6 @@ def test_version_print_last_released_tag_on_nonrelease_branch(
get_cfg_value_from_def: GetCfgValueFromDefFn,
get_versions_from_repo_build_def: GetVersionsFromRepoBuildDefFn,
run_cli: RunCliFn,
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
strip_logging_messages: StripLoggingMessagesFn,
Expand Down Expand Up @@ -989,7 +968,6 @@ def test_version_print_next_version_fails_on_detached_head(
simulate_change_commits_n_rtn_changelog_entry: SimulateChangeCommitsNReturnChangelogEntryFn,
get_commit_def_fn: GetCommitDefFn[CommitParser[ParseResult, ParserOptions]],
default_parser: CommitParser[ParseResult, ParserOptions],
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
strip_logging_messages: StripLoggingMessagesFn,
Expand Down Expand Up @@ -1052,7 +1030,6 @@ def test_version_print_next_tag_fails_on_detached_head(
simulate_change_commits_n_rtn_changelog_entry: SimulateChangeCommitsNReturnChangelogEntryFn,
get_commit_def_fn: GetCommitDefFn[CommitParser[ParseResult, ParserOptions]],
default_parser: CommitParser[ParseResult, ParserOptions],
mocked_git_fetch: MagicMock,
mocked_git_push: MagicMock,
post_mocker: Mocker,
strip_logging_messages: StripLoggingMessagesFn,
Expand Down
Loading
Loading