diff --git a/CHANGELOG.md b/CHANGELOG.md index e2d8c87c..f20f3a4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ Valid subsections within a version are: Things to be included in the next release go here. +### Fixed + +- Actually fixed the issue with the semantic-release configuration preventing updated files with each new release version from being properly updated in the repo as a part of the release. + --- ## v1.0.1 (2024-08-27) diff --git a/pyproject.toml b/pyproject.toml index 0c996141..5cafb4d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -145,12 +145,6 @@ order-by-type = false ] [tool.semantic_release] -assets = [ - ".github", - "README.md", - "actions", - "workflows" -] build_command = """ python -m scripts.bump_version_in_files """ diff --git a/scripts/bump_version_in_files.py b/scripts/bump_version_in_files.py index 11a2be1a..e7879d9a 100644 --- a/scripts/bump_version_in_files.py +++ b/scripts/bump_version_in_files.py @@ -8,6 +8,7 @@ import os import re +import subprocess from pathlib import Path @@ -52,6 +53,7 @@ def update_github_actions_version(filepath: Path, incoming_version: str) -> None ) print(f'Bumping version in "{filepath}" to', incoming_version) filepath.write_text(updated_content) + subprocess.check_call(["git", "add", filepath.as_posix()]) # noqa: S603,S607 else: print(f'No GitHub Workflow/Action usage found in "{filepath}", skipping update.') diff --git a/tests/test_bump_version_in_files.py b/tests/test_bump_version_in_files.py index ab596b33..a5c668fe 100644 --- a/tests/test_bump_version_in_files.py +++ b/tests/test_bump_version_in_files.py @@ -1,12 +1,21 @@ """Test the bump_version_in_files module.""" from pathlib import Path +from typing import Generator +from unittest.mock import MagicMock, patch import pytest from scripts.bump_version_in_files import get_file_paths, update_github_actions_version +@pytest.fixture(autouse=True) +def mock_subprocess_check_call() -> Generator[None, None, None]: + """Mock subprocess.check_call for all tests.""" + with patch("subprocess.check_call", MagicMock(return_value=None)): + yield + + @pytest.fixture() def temporary_directory(tmp_path: Path) -> Path: """Create a temporary directory."""