Skip to content

Publish to PyPI

Publish to PyPI #4

Workflow file for this run

name: Publish to PyPI
on:
workflow_dispatch:
release:
types: [published]
jobs:
build-and-publish:
name: Build and publish
runs-on: ubuntu-latest
environment:
name: pypi
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.12'
- name: Install project with development dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Run tests
run: pytest
- name: Build distributions
run: python -m build
- name: Publish package to PyPI
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1