Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/publish-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish Python to PyPI

on:
push:
tags:
# Final releases only. Prerelease tags (vX.Y.Z-pre-N) use a format PyPI
# rejects under PEP 440, so they are intentionally not published here.
- 'v[0-9]+.[0-9]+.[0-9]+'

permissions:
contents: read

jobs:
publish:
name: Build and publish client-signals to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write # OIDC for PyPI trusted publishing (no API tokens)
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@v7.0.0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Stamp version from tag
run: |
# Strip the leading 'v'; python/pyproject.toml ships a 0.0.0 placeholder.
VERSION="${GITHUB_REF_NAME#v}"
echo "Publishing client-signals ${VERSION}"
sed -i "s/^version = \".*\"/version = \"${VERSION}\"/" pyproject.toml

- name: Install build tooling and run tests
run: |
python -m pip install --upgrade pip build
python -m unittest

- name: Build package
run: python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: python/dist/
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,8 @@ See [docs/signals.md](docs/signals.md) for signal rationale and

## Releases

The existing tag workflow creates a GitHub release. npm, PyPI, and Hex
publishing are not automated yet.
Pushing a `vX.Y.Z` tag creates a GitHub release and publishes the Python
package to PyPI (`.github/workflows/publish-python.yml`, via PyPI trusted
publishing — no API tokens). The workflow stamps the tag's version into
`python/pyproject.toml` at build time. npm and Hex publishing are not
automated yet.
Loading