Skip to content

Workflow file for this run

name: Publish Python Package to PyPI
on:
release:
types: [created]
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v3
# Step 2: Set up Python environment
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
# Step 3: Install Build Tools and Dev Dependencies
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install build twine uv
pip install ".[dev]"
# Step 4: Run Linting with Ruff
- name: Run Linting with Ruff
run: |
ruff check .
# Step 5: Run Type Checking with MyPy
- name: Run Type Checking with MyPy
run: |
mypy .
# Step 6: (Optional) Run Additional Development Tools
# - name: Run Tests with Pytest
# run: |
# pip install pytest
# pytest
# Step 7: Build the Package
- name: Build Package
run: |
python -m build
# Step 8: Publish to PyPI
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m twine upload dist/* --non-interactive --verbose