Skip to content

Publish to PyPI

Publish to PyPI #1

Workflow file for this run

name: Publish to PyPI
on:
release:
types: [published]
workflow_dispatch:
jobs:
build-and-publish:
runs-on: ubuntu-latest
# Uses GitHub Environment for trusted publishing (OIDC)
# Required setup:
# 1. Create a GitHub environment named "release" in repo settings
# 2. Configure PyPI trusted publisher for this repo:
# - Go to PyPI project settings > Publishing
# - Add GitHub publisher with:
# - Owner: your-github-username
# - Repository: claude-git
# - Workflow: publish.yml
# - Environment: release (optional but recommended)
environment: release
permissions:
id-token: write # Required for OIDC authentication with PyPI
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish to PyPI
# Uses PyPA's official action with OIDC authentication
# No API tokens or passwords needed - uses GitHub's OIDC provider
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true