File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -20,10 +20,33 @@ jobs:
2020 with :
2121 python-version : " 3.11"
2222
23+ - name : Verify tag matches package version
24+ run : |
25+ TAG_VERSION="${GITHUB_REF_NAME#v}"
26+ PACKAGE_VERSION="$(python - <<'PY'
27+ import tomllib
28+ with open("pyproject.toml", "rb") as f :
29+ data = tomllib.load(f)
30+ print(data["project"]["version"])
31+ PY
32+ )"
33+ if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
34+ echo "Tag version ($TAG_VERSION) does not match package version ($PACKAGE_VERSION)."
35+ exit 1
36+ fi
37+
2338 - name : Build distributions
2439 run : |
2540 python -m pip install -U pip build
2641 python -m build
2742
28- - name : Publish to PyPI
43+ - name : Publish to PyPI (API token)
44+ if : ${{ secrets.PYPI_API_TOKEN != '' }}
45+ uses : pypa/gh-action-pypi-publish@release/v1
46+ with :
47+ user : __token__
48+ password : ${{ secrets.PYPI_API_TOKEN }}
49+
50+ - name : Publish to PyPI (trusted publisher)
51+ if : ${{ secrets.PYPI_API_TOKEN == '' }}
2952 uses : pypa/gh-action-pypi-publish@release/v1
You can’t perform that action at this time.
0 commit comments