Skip to content

Commit

Permalink
Update CI files
Browse files Browse the repository at this point in the history
  • Loading branch information
pulpbot authored and dralley committed Nov 20, 2024
1 parent de9f0e9 commit 57891e0
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 33 deletions.
21 changes: 0 additions & 21 deletions .bumpversion.cfg

This file was deleted.

25 changes: 16 additions & 9 deletions .ci/scripts/check_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import argparse
import re
import os
import tomllib
import yaml
from tempfile import TemporaryDirectory
from packaging.version import Version
Expand All @@ -22,6 +23,17 @@
Z_CHANGELOG_EXTS = [".bugfix", ".doc", ".misc"]


def current_version(repo):
try:
pyproject_toml = tomllib.loads(repo.git.show(f"{DEFAULT_BRANCH}:pyproject.toml"))
current_version = pyproject_toml["project"]["version"]
except Exception:
current_version = repo.git.grep(
"current_version", DEFAULT_BRANCH, "--", ".bumpversion.cfg"
).split("=")[-1]
return Version(current_version)


def main():
"""Check which branches need a release."""
parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -113,15 +125,10 @@ def main():
for change in changes.split("\n"):
_, ext = os.path.splitext(change)
if ext in Y_CHANGELOG_EXTS:
# We don't put Y release bumps in the commit message, check file instead
# The 'current_version' is always the next version to release
next_version = repo.git.grep(
"current_version", DEFAULT_BRANCH, "--", ".bumpversion.cfg"
).split("=")[-1]
next_version = Version(next_version)
print(
f"A new Y-release is needed! New Version: {next_version.base_version}"
)
# We don't put Y release bumps in the commit message, check file instead.
# The 'current_version' is always the dev of the next version to release.
next_version = current_version(repo).base_version
print(f"A new Y-release is needed! New Version: {next_version}")
releases.append(next_version)
break

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-393-g0e700c1
2021.08.26-396-gde50fc9
2 changes: 1 addition & 1 deletion .github/workflows/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set -euv

source .github/workflows/scripts/utils.sh

PLUGIN_VERSION="$(sed -n -e 's/^\s*current_version\s*=\s*//p' .bumpversion.cfg | python -c 'from packaging.version import Version; print(Version(input()))')"
PLUGIN_VERSION="$(bump-my-version show current_version | tail -n -1 | python -c 'from packaging.version import Version; print(Version(input()))')"
PLUGIN_SOURCE="./pulpcore/dist/pulpcore-${PLUGIN_VERSION}-py3-none-any.whl"

export PULP_API_ROOT="/pulp/"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- name: "Install python dependencies"
run: |
echo ::group::PYDEPS
pip install towncrier twine wheel httpie docker netaddr boto3 'ansible~=10.3.0' mkdocs jq jsonpatch
pip install towncrier twine wheel httpie docker netaddr boto3 'ansible~=10.3.0' mkdocs jq jsonpatch bump-my-version
echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/pulpcore/.ci/assets/httpie/" >> $GITHUB_ENV
echo ::endgroup::
Expand Down
31 changes: 31 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,34 @@ ignore = [
"lint_requirements.txt",
".flake8",
]

[tool.bumpversion]
# This section is managed by the plugin template. Do not edit manually.

current_version = "3.22.34.dev"
commit = false
tag = false
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(\\.(?P<release>[a-z]+))?"
serialize = [
"{major}.{minor}.{patch}.{release}",
"{major}.{minor}.{patch}",
]

[tool.bumpversion.parts.release]
# This section is managed by the plugin template. Do not edit manually.

optional_value = "prod"
values = [
"dev",
"prod",
]

[[tool.bumpversion.files]]
# This section is managed by the plugin template. Do not edit manually.

filename = "./pulpcore/app/apps.py"
search = "version = \"{current_version}\""
replace = "version = \"{new_version}\""

[[tool.bumpversion.files]]
filename = "./setup.py"

0 comments on commit 57891e0

Please sign in to comment.