Skip to content
name: "Publish Python 🐍 distributions πŸ“¦ to PyPI"
on:
release:
types: [published]
jobs:
build:
name: "Build distribution πŸ“¦"
runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: "Set up Python 3.x"
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.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@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: "Publish Python 🐍 distribution πŸ“¦ to PyPI"
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/crazylibs/${{ github.ref_name }}
permissions:
id-token: write
steps:
- name: "Download dists"
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: python-package-distributions
path: dist/
- name: "Publish distribution πŸ“¦ to PyPI"
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
with:
verbose: true
print-hash: true