chore: project description #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Package | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Verify tag matches package version | |
| run: | | |
| python - <<'PY' | |
| import os | |
| import pathlib | |
| import tomllib | |
| pyproject = tomllib.loads(pathlib.Path("pyproject.toml").read_text()) | |
| version = pyproject["project"]["version"] | |
| tag = os.environ["GITHUB_REF_NAME"] | |
| normalized_tag = tag[1:] if tag.startswith("v") else tag | |
| if normalized_tag != version: | |
| raise SystemExit( | |
| f"Tag {tag!r} does not match project version {version!r}." | |
| ) | |
| PY | |
| - name: Build package | |
| run: uv build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |