Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Ci/fix docs version reference updater #1141

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
19 changes: 16 additions & 3 deletions 19 .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ jobs:
needs: eval-changes
with:
python-versions-linux: '["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]'
# Since the test suite takes ~4 minutes to complete on windows, and windows is billed higher
# we are only going to run it on the oldest version of python we support. The older version
# will be the most likely area to fail as newer minor versions maintain compatibility.
python-versions-windows: '["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]'
files-changed: ${{ needs.eval-changes.outputs.any-file-changes }}
build-files-changed: ${{ needs.eval-changes.outputs.build-changes }}
Expand Down Expand Up @@ -116,6 +113,22 @@ jobs:
name: ${{ needs.validate.outputs.distribution-artifacts }}
path: dist

- name: Evaluate | Determine Next Version
id: version
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
root_options: "-v --noop"

- name: Release | Bump Version in Docs
if: steps.version.outputs.released == 'true' && steps.version.outputs.is_prerelease == 'false'
env:
NEW_VERSION: ${{ steps.version.outputs.version }}
NEW_RELEASE_TAG: ${{ steps.version.outputs.tag }}
run: |
python -m scripts.bump_version_in_docs
git add docs/*

- name: Release | Python Semantic Release
id: release
uses: ./
Expand Down
2 changes: 0 additions & 2 deletions 2 pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,6 @@ ignore_names = ["change_to_ex_proj_dir", "init_example_project"]
logging_use_named_masks = true
commit_parser = "angular"
build_command = """
python -m scripts.bump_version_in_docs
git add docs/*
python -m pip install -e .[build]
python -m build .
"""
Expand Down
23 changes: 13 additions & 10 deletions 23 scripts/bump_version_in_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,38 @@

from os import getenv
from pathlib import Path
from re import compile as RegExp # noqa: N812
from re import compile as regexp

PROJ_DIR = Path(__file__).resolve().parent.parent
DOCS_DIR = PROJ_DIR / "docs"


def update_github_actions_example(filepath: Path, new_version: str) -> None:
psr_regex = RegExp(r"(uses:.*python-semantic-release)@v\d+\.\d+\.\d+")
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]:
for regex in [psr_regex, psr_publish_action_regex]:
file_content_lines = list(
map(
lambda line, regex=regex: regex.sub(r"\1@v" + new_version, line), # type: ignore[misc]
lambda line, regex=regex: regex.sub(r"\1@" + release_tag, line), # type: ignore[misc]
file_content_lines,
)
)

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


if __name__ == "__main__":
new_version = getenv("NEW_VERSION")
new_release_tag = getenv("NEW_RELEASE_TAG")

if not new_version:
print("NEW_VERSION environment variable is not set")
if not new_release_tag:
print("NEW_RELEASE_TAG environment variable is not set")
exit(1)

update_github_actions_example(
DOCS_DIR / "automatic-releases" / "github-actions.rst", new_version
DOCS_DIR / "automatic-releases" / "github-actions.rst", new_release_tag
)
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.