Skip to content

Commit

Permalink
build: Modify script to properly add changed files to git before sema…
Browse files Browse the repository at this point in the history
…ntic-release commits the changes
  • Loading branch information
nfelt14 committed Aug 27, 2024
1 parent c9acbfb commit 3cff434
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
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
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 @@ 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

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

0 comments on commit 3cff434

Please sign in to comment.