Skip to content
name: "Publish Python 🐍 distributions πŸ“¦ to PyPI"
on:
release:
types: [released]
jobs:
build-publish:
name: "Build and publish Python 🐍 distributions πŸ“¦ to PyPI"
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: "Checkout repository"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: "Set up Python 3.x"
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: "3.x"
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: "Install pypa/build"
run: >-
python -m
pip install
build
--user
- name: "Build a binary wheel and a source tarball"
run: >-
python -m
build
--outdir dist/
- name: "Upload packages"
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: packages
path: dist
- name: "Publish distribution πŸ“¦ to PyPI"
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e # v1.8.10
with:
skip-existing: true
verbose: true
print-hash: true