Skip to content

Commit

Permalink
Update CI files
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
pulpbot committed Mar 24, 2024
1 parent fca408d commit 16c75d7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
28 changes: 25 additions & 3 deletions .ci/scripts/check_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,31 @@ def main():
# Blobless clone does not have file contents for Z branches,
# check commit message for last Z bump
git_branch = f"origin/{branch}"
next_version = repo.git.log(
"--oneline", "--grep=Bump to", "-n 1", git_branch, "--", ".bumpversion.cfg"
).split("to")[-1]
next_version = None
bump_commit = repo.git.log(
"--oneline",
"--grep=Bump version",
"-n 1",
git_branch,
"--",
".bumpversion.cfg",
)
if bump_commit:
next_version = bump_commit.split("→ ")[-1]
# If not found - try old-commit-msg
if not next_version:
bump_commit = repo.git.log(
"--oneline",
"--grep=Bump to",
"-n 1",
git_branch,
"--",
".bumpversion.cfg",
)
next_version = bump_commit.split("to ")[-1] if bump_commit else None

# You could, theoretically, be next_vers==None here - but that's always
# been true for this script.
next_version = Version(next_version)
print(
f"A Z-release is needed for {branch}, "
Expand Down
9 changes: 7 additions & 2 deletions .ci/scripts/collect_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import toml
from git import GitCommandError, Repo
from pkg_resources import parse_version
from packaging.version import parse as parse_version

# Read Towncrier settings
tc_settings = toml.load("pyproject.toml")["tool"]["towncrier"]
Expand All @@ -28,15 +28,20 @@
TITLE_FORMAT = tc_settings.get("title_format", "{name} {version} ({project_date})")


# Build a regex to find the header of a changelog section.
# It must have a single capture group to single out the version.
# see help(re.split) for more info.
NAME_REGEX = r".*"
VERSION_REGEX = r"([0-9]+\.[0-9]+\.[0-9][0-9ab]*)"
VERSION_REGEX = r"[0-9]+\.[0-9]+\.[0-9][0-9ab]*"
VERSION_CAPTURE_REGEX = rf"({VERSION_REGEX})"
DATE_REGEX = r"[0-9]{4}-[0-9]{2}-[0-9]{2}"
TITLE_REGEX = (
"("
+ re.escape(
TITLE_FORMAT.format(name="NAME_REGEX", version="VERSION_REGEX", project_date="DATE_REGEX")
)
.replace("NAME_REGEX", NAME_REGEX)
.replace("VERSION_REGEX", VERSION_CAPTURE_REGEX, 1)
.replace("VERSION_REGEX", VERSION_REGEX)
.replace("DATE_REGEX", DATE_REGEX)
+ ")"
Expand Down
2 changes: 1 addition & 1 deletion .github/template_gitref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.08.26-320-gb91fb8e
2021.08.26-322-g8700c1c
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: "Install python dependencies"
run: |
echo ::group::PYDEPS
pip install gitpython toml
pip install gitpython packaging toml
echo ::endgroup::
- name: "Configure Git with pulpbot name and email"
Expand Down

0 comments on commit 16c75d7

Please sign in to comment.