Skip to content

Release & Publish 🐍 #17

Release & Publish 🐍

Release & Publish 🐍 #17

Workflow file for this run

name: Publish to PyPI 🐍
on:
release:
types: [published] # Triggers when you click "Publish Release" on GitHub
workflow_dispatch:
jobs:
build-and-publish:
name: Build & Publish
runs-on: ubuntu-latest
# Permission needed for the publishing action to work
permissions:
id-token: write # IMPORTANT: This is required for trusted publishing
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
# This creates the 'dist/' folder at the root
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
# It automatically looks in 'dist/', so we don't need to specify paths!