File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 push :
77 tags : ["v*"]
88permissions :
9- contents : read
9+ contents : write # tag-anchored GitHub Release
1010jobs :
1111 publish :
1212 runs-on : ubuntu-latest
1313 permissions :
1414 id-token : write
1515 steps :
1616 - uses : actions/checkout@v4
17+ # A tag must publish exactly the version it names; a stale
18+ # pyproject.toml fails fast instead of a late PyPI reject.
19+ - name : tag matches package version
20+ run : |
21+ v=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
22+ [ "v$v" = "$GITHUB_REF_NAME" ] || { echo "tag $GITHUB_REF_NAME != pyproject v$v" >&2; exit 1; }
1723 - uses : actions/setup-python@v5
1824 with :
1925 python-version : " 3.12"
2026 - run : pip install build pytest && python -m pytest tests/ -q
2127 - run : python -m build
2228 - uses : pypa/gh-action-pypi-publish@release/v1
29+ - name : github release
30+ run : gh release create "$GITHUB_REF_NAME" --generate-notes
31+ env :
32+ GH_TOKEN : ${{ github.token }}
You can’t perform that action at this time.
0 commit comments