From da90d32284c5f8f48a0fa83aae0569094e2ef829 Mon Sep 17 00:00:00 2001 From: Jimisola Laursen Date: Sun, 8 Mar 2026 21:33:20 +0100 Subject: [PATCH] fix: support bare semver tags and fix check_release workflow - Add pattern to poetry-dynamic-versioning to match tags without v prefix - Fix check_release.yml: was a no-op (push event never fires on release) - Validate bare semver tag format (e.g. 1.2.3, not v1.2.3) - Validate release targets main, hotfix/*, or release/* branch Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/check_release.yml | 18 ++++++++++++++---- pyproject.toml | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check_release.yml b/.github/workflows/check_release.yml index 6c35b4c..e659f6b 100644 --- a/.github/workflows/check_release.yml +++ b/.github/workflows/check_release.yml @@ -1,4 +1,4 @@ -name: Lint (black and flake8) +name: Check Release on: workflow_call: @@ -6,6 +6,16 @@ jobs: check-release: runs-on: ubuntu-latest steps: - - name: Check branch and tag - if: github.event_name == 'push' && !(github.ref == 'refs/heads/main' && startsWith(github.ref, 'refs/tags/v')) - run: exit 1 \ No newline at end of file + - name: Check tag format + run: | + if ! echo "${{ github.ref }}" | grep -qE '^refs/tags/[0-9]+\.[0-9]+\.[0-9]+'; then + echo "Tag must be a semver version like 1.2.3 (no v prefix)" + exit 1 + fi + - name: Check branch + run: | + branch="${{ github.event.release.target_commitish }}" + if [[ "$branch" != "main" && "$branch" != hotfix/* && "$branch" != release/* ]]; then + echo "Release must target main, hotfix/*, or release/* branch (got: $branch)" + exit 1 + fi \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index e5217ea..7a99153 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,6 +68,7 @@ max-complexity = 10 enable = true style = "pep440" dirty = false +pattern = "^(?P\\d+\\.\\d+\\.\\d+.*)$" format = "{base}.dev{distance}" [tool.reqstool]