Skip to content

3.0.0

3.0.0 #13

Workflow file for this run

name: Publish Python Package
# This workflow automates the process of building and publishing a Python package.
# It triggers on a published release, which publishes the package to PyPI.
on:
release:
types: [published] # Trigger on published releases for PyPI deployment.
jobs:
build:
name: Build and Publish
runs-on: ubuntu-latest # Use the latest Ubuntu runner.
steps:
# Step 1: Check out the repository code.
- uses: actions/checkout@v4
# Step 2: Set up Python 3.11 for the workflow.
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
# Step 3: Install the necessary tools for building and publishing the package.
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine
# Step 4: Build the Python package.
- name: Build package
run: python -m build
# Step 5: Publish the package to PyPI if the workflow is triggered by a published release (tag).
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/')
env:
TWINE_USERNAME: __token__ # Use an API token for authentication.
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} # Securely access the PyPI API token.
run: twine upload dist/*