Skip to content

Workflow file for this run

name: Publish Python 🐍 distributions 📦 to PyPI
on:
release:
types:
- published
permissions:
contents: read
jobs:
build-n-publish-pypi:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
environment: production
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
files.pythonhosted.org:443
github.com:443
pypi.org:443
upload.pypi.org:443
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install packaging libraries
run: pip install flit
- name: Build a binary wheel and a source tarball
run: flit build
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1