Skip to content

Publish Python package to PyPI #1

Publish Python package to PyPI

Publish Python package to PyPI #1

Workflow file for this run

name: Publish Python package to PyPI
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
id-token: write # REQUIRED for PyPI Trusted Publishing (OIDC)
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install build tooling
run: python -m pip install --upgrade pip build
- name: Build sdist and wheel
run: python -m build
- name: Publish to PyPI (Trusted Publishing)
uses: pypa/gh-action-pypi-publish@release/v1
with:
# For trusted publishing, you typically do NOT set username/password.
# If you are publishing to TestPyPI instead, you can set repository-url.
# repository-url: https://test.pypi.org/legacy/
verbose: true