name: Publish # Publishes to PyPI when a GitHub release is published. # # No token is stored anywhere: PyPI trusts this workflow through OIDC # (trusted publishing). On pypi.org a "pending publisher" must have been # registered with exactly these four values: # # Owner ElvisClaros # Repository claude-logbook # Workflow publish.yml # Environment pypi # # If any of them does not match, PyPI rejects the upload. on: release: types: [published] permissions: {} jobs: publish: runs-on: ubuntu-latest environment: name: pypi url: https://pypi.org/p/claude-logbook permissions: id-token: write # the only thing trusted publishing needs steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.13" # The number lives in claude_logbook/__init__.py and it is easy to forget # to bump it. Better to fail here than publish something mislabelled: a # version uploaded to PyPI can never be replaced, only yanked. - name: Tag matches __version__ run: | tag="${GITHUB_REF_NAME#v}" ver="$(python -c 'import claude_logbook; print(claude_logbook.__version__)')" echo "tag=$tag __version__=$ver" test "$tag" = "$ver" - name: Build run: | python -m pip install --upgrade build python -m build - name: Artifacts are sound run: | python -m pip install --upgrade twine twine check dist/* - uses: pypa/gh-action-pypi-publish@release/v1