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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: "Set up Python 3.x"
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
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@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: packages
path: dist
- name: "Publish distribution πŸ“¦ to PyPI"
uses: pypa/gh-action-pypi-publish@f8c70e705ffc13c3b4d1221169b84f12a75d6ca8 # v1.8.8
with:
skip-existing: true
verbose: true
print-hash: true