Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,18 @@ jobs:
- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
with:
python-version: "3.12"
python-version: "3.10"

- name: Verify tag matches pyproject.toml version
env:
TAG_INPUT: ${{ inputs.tag }}
run: |
set -euo pipefail
py_ver=$(python -c "import tomllib, pathlib; print(tomllib.loads(pathlib.Path('pyproject.toml').read_bytes())['project']['version'])")
# Parse [project].version with a regex anchored at column 0 so it
# can't accidentally match `target-version` or `python_version`
# entries further down. tomllib would be cleaner but isn't in
# 3.10's stdlib, and pulling in tomli for one read isn't worth it.
py_ver=$(python -c "import re,sys; m=re.search(r'(?m)^version\s*=\s*\"([^\"]+)\"', open('pyproject.toml').read()); sys.exit('version not found in pyproject.toml') if not m else print(m.group(1))")
if [[ "$TAG_INPUT" != "v${py_ver}" && "$TAG_INPUT" != "$py_ver" ]]; then
echo "::error::Tag '$TAG_INPUT' does not match pyproject.toml version '$py_ver' (expected 'v$py_ver' or '$py_ver')."
exit 1
Expand Down Expand Up @@ -166,7 +170,7 @@ jobs:

- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
with:
python-version: "3.12"
python-version: "3.10"

- name: Publish via bin/publish-pypi.sh
env:
Expand Down
Loading