Skip to content

chore(config): add version stamp to github-actions examples in docs #1272

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

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
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ build_command = """
major_on_zero = true
version_variables = [
"src/gh_action/requirements.txt:python-semantic-release:nf",
"docs/configuration/automatic-releases/github-actions.rst:python-semantic-release/python-semantic-release:tf",
"docs/configuration/automatic-releases/github-actions.rst:python-semantic-release/publish-action:tf",
]
version_toml = ["pyproject.toml:project.version"]

Expand Down
24 changes: 0 additions & 24 deletions scripts/bump_version_in_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,6 @@
tag_replace_pattern = regexp(r"\$(NEW_RELEASE_TAG|{NEW_RELEASE_TAG})")


def update_github_actions_example(filepath: Path, release_tag: str) -> None:
psr_regex = regexp(r"(uses: python-semantic-release/python-semantic-release)@\S+$")
psr_publish_action_regex = regexp(
r"(uses: python-semantic-release/publish-action)@\S+$"
)
file_content_lines: list[str] = filepath.read_text().splitlines()

for regex in [psr_regex, psr_publish_action_regex]:
file_content_lines = list(
map(
lambda line, regex=regex: regex.sub(r"\1@" + release_tag, line), # type: ignore[misc]
file_content_lines,
)
)

print(f"Bumping version in {filepath} to", release_tag)
filepath.write_text(str.join("\n", file_content_lines) + "\n")


def envsubst(filepath: Path, version: str, release_tag: str) -> None:
file_content = filepath.read_text()

Expand Down Expand Up @@ -59,10 +40,5 @@ def envsubst(filepath: Path, version: str, release_tag: str) -> None:
print("NEW_VERSION environment variable is not set")
exit(1)

update_github_actions_example(
DOCS_DIR / "configuration" / "automatic-releases" / "github-actions.rst",
new_release_tag,
)

for doc_file in DOCS_DIR.rglob("*.rst"):
envsubst(filepath=doc_file, version=new_version, release_tag=new_release_tag)