Skip to content

v0.1.10

v0.1.10 #20

Workflow file for this run

name: publish-pypi
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
build-and-publish:
runs-on: ubuntu-latest
environment: pypi
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@4267e283df95c05d9f16ece6624106f44613b489
with:
python-version: "3.12"
- name: Check tag matches version (release events)
if: ${{ github.event_name == 'release' }}
shell: bash
run: |
TAG="${GITHUB_REF_NAME#v}"
PYVER=$(python - <<'PY'
import pathlib
try:
import tomllib as toml
except Exception:
import tomli as toml
t=pathlib.Path("pyproject.toml").read_text(encoding="utf-8")
d=toml.loads(t)
v=(d.get("project") or {}).get("version") or ((d.get("tool") or {}).get("poetry") or {}).get("version")
print(v or "")
PY
)
if [ "$PYVER" != "$TAG" ]; then
echo "pyproject version ($PYVER) != tag ($TAG)"
exit 1
fi
- run: python -m pip install --upgrade pip build
- run: python -m build
- name: Publish to PyPI (OIDC)
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist