Repository navigation
Release 0.1.0 #1
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 to PyPI | |
| on: | |
| release: | |
| types: | |
| - published | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build and validate distributions | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| cache: pip | |
| - name: Install build tools | |
| run: python -m pip install --upgrade pip build twine | |
| - name: Check release tag matches package version | |
| env: | |
| RELEASE_TAG: ${{ github.event.release.tag_name }} | |
| run: | | |
| python - <<'PY' | |
| import os | |
| import pathlib | |
| import tomllib | |
| project = tomllib.loads( | |
| pathlib.Path("pyproject.toml").read_text(encoding="utf-8") | |
| ) | |
| package_version = project["project"]["version"] | |
| release_version = os.environ["RELEASE_TAG"].removeprefix("v") | |
| if package_version != release_version: | |
| raise SystemExit( | |
| f"Release tag {release_version!r} does not match " | |
| f"package version {package_version!r}" | |
| ) | |
| PY | |
| - name: Build distributions | |
| run: python -m build | |
| - name: Validate distributions | |
| run: python -m twine check dist/* | |
| - name: Smoke-test wheel | |
| run: | | |
| python -m venv /tmp/jamkit-smoke | |
| /tmp/jamkit-smoke/bin/python -m pip install dist/*.whl | |
| /tmp/jamkit-smoke/bin/python -c \ | |
| "from jamkit.hack_the_robot.loader import load_workshop" | |
| - name: Upload distributions | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-distributions | |
| path: dist/ | |
| if-no-files-found: error | |
| publish: | |
| name: Publish to PyPI | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/project/jamkit/ | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download distributions | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-distributions | |
| path: dist/ | |
| - name: Publish distributions | |
| uses: pypa/gh-action-pypi-publish@release/v1 |