diff --git a/.github/workflows/release-dev.yaml b/.github/workflows/release-dev.yaml index 1354e89b..5c8efd25 100644 --- a/.github/workflows/release-dev.yaml +++ b/.github/workflows/release-dev.yaml @@ -35,7 +35,7 @@ jobs: run: | CURRENT_VERSION=$(grep -oP 'version = "\K[^"]+' pyproject.toml | head -1) echo "Version from pyproject.toml: $CURRENT_VERSION" - CURRENT_VERSION=$(echo "$CURRENT_VERSION" | sed 's/rc/-rc/') + CURRENT_VERSION=$(echo "$CURRENT_VERSION" | sed 's/\([0-9]\)rc/\1-rc/') echo "Semver-formatted version: $CURRENT_VERSION" NEXT_VERSION=$(uv run python -c "import semver; ver = semver.Version.parse('$CURRENT_VERSION').bump_prerelease(); print(ver)") echo "Next version: $NEXT_VERSION" diff --git a/.github/workflows/release-prod.yaml b/.github/workflows/release-prod.yaml index da7e657f..aab8db15 100644 --- a/.github/workflows/release-prod.yaml +++ b/.github/workflows/release-prod.yaml @@ -35,7 +35,7 @@ jobs: run: | CURRENT_VERSION=$(grep -oP 'version = "\K[^"]+' pyproject.toml | head -1) echo "Version from pyproject.toml: $CURRENT_VERSION" - CURRENT_VERSION=$(echo "$CURRENT_VERSION" | sed 's/rc/-rc/') + CURRENT_VERSION=$(echo "$CURRENT_VERSION" | sed 's/\([0-9]\)rc/\1-rc/') echo "Semver-formatted version: $CURRENT_VERSION" NEXT_VERSION=$(uv run python -c "import semver; ver = semver.Version.parse('$CURRENT_VERSION').finalize_version(); print(ver)") echo "Next version: $NEXT_VERSION" diff --git a/src/djtools/version.py b/src/djtools/version.py index 45034766..64cf35c0 100644 --- a/src/djtools/version.py +++ b/src/djtools/version.py @@ -13,8 +13,8 @@ def get_version() -> str: Version string. """ version = importlib.metadata.version(__package__) - major_minor_patch_regex = re.compile(r"([0-9]+)\.([0-9]+)\.([0-9]+)") - match = re.match(major_minor_patch_regex, version).group() + version_regex = re.compile(r"([0-9]+)\.([0-9]+)\.([0-9]+)") + match = re.match(version_regex, version).group() if match: suffix = version.split(match)[-1]