Skip to content

Release 0.9.2: field-resilience APIs from the on-hardware incident work #6

Release 0.9.2: field-resilience APIs from the on-hardware incident work

Release 0.9.2: field-resilience APIs from the on-hardware incident work #6

Workflow file for this run

name: Publish to PyPI
# Builds the sdist + wheel and uploads them to PyPI whenever a version tag
# (v0.9.0, v1.0.0, ...) is pushed. Authentication is PyPI "Trusted Publishing"
# (OIDC) — there is no API token or secret stored in the repo; PyPI is
# configured (Account -> Publishing) to trust this exact workflow file in
# czei/scrollkit, gated on the `pypi` environment.
#
# Release procedure: bump `version` in pyproject.toml AND `__version__` in
# src/scrollkit/__init__.py, update CHANGELOG.md, commit, then:
# git tag v<version> && git push scrollkit master --tags
on:
push:
tags: ["v*"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Check tag matches pyproject version
# A v0.9.1 tag on a pyproject still saying 0.9.0 would publish the
# wrong thing; fail fast instead.
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PYPROJECT_VERSION="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"])')"
if [ "$TAG_VERSION" != "$PYPROJECT_VERSION" ]; then
echo "Tag $GITHUB_REF_NAME does not match pyproject.toml version $PYPROJECT_VERSION" >&2
exit 1
fi
- name: Build sdist and wheel
run: |
python -m pip install --upgrade pip build twine
python -m build
- name: Check package metadata
run: python -m twine check --strict dist/*
- name: Check the wheel carries the simulator package data
# Fonts + calibration JSONs are declared in [tool.setuptools.package-data];
# CI's editable install can't detect them going missing, so guard here.
run: |
python -m zipfile -l dist/*.whl | grep -q "simulator/fonts/tom-thumb.bdf"
python -m zipfile -l dist/*.whl | grep -q "simulator/core/matrixportal_s3_baseline.json"
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish:
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/scrollkit
permissions:
id-token: write # required for PyPI Trusted Publishing (OIDC)
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1