Skip to content

Build and Publish to PyPI #8

Build and Publish to PyPI

Build and Publish to PyPI #8

Workflow file for this run

name: Build and Publish to PyPI
on:
workflow_dispatch:
inputs:
# Latest commit to include with the release. If omitted, use the latest commit on the main branch.
sha:
description: Commit SHA
type: string
# Create the sdist and build the wheels, but do not publish to PyPI / GitHub.
dry-run:
description: Dry run
type: boolean
default: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.sha || 'main' }} # Use provided SHA or default to main branch
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x' # Specify Python version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
pip install twine
python -m twine upload dist/*