Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build script to properly add changed files to git during the release process #21

Merged
merged 2 commits into from
Aug 27, 2024
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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down
2 changes: 2 additions & 0 deletions scripts/bump_version_in_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import re
import subprocess

from pathlib import Path

Expand Down Expand Up @@ -52,6 +53,7 @@
)
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

Check notice on line 56 in scripts/bump_version_in_files.py

View check run for this annotation

codefactor.io / CodeFactor

scripts/bump_version_in_files.py#L56

Starting a process with a partial executable path (B607)
else:
print(f'No GitHub Workflow/Action usage found in "{filepath}", skipping update.')

Expand Down
9 changes: 9 additions & 0 deletions tests/test_bump_version_in_files.py
Original file line number Diff line number Diff line change
@@ -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."""
Expand Down