Manual Publish to PyPI #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Manual Publish to PyPI | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| name: Build and publish | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/${{ steps.read-package.outputs.package-name }} | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Read package name from pyproject.toml | |
| id: read-package | |
| run: | | |
| PACKAGE_NAME=$(uv run --with toml-cli python -c " | |
| import tomllib | |
| with open('pyproject.toml', 'rb') as f: | |
| data = tomllib.load(f) | |
| print(data['project']['name']) | |
| ") | |
| echo "package-name=$PACKAGE_NAME" >> $GITHUB_OUTPUT | |
| echo "PyPI URL: https://pypi.org/p/$PACKAGE_NAME" | |
| - name: Build distribution | |
| run: uv build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |