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]