Build & Publish to PyPI #7
Workflow file for this run
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: Publish Python Package | |
| on: | |
| push: | |
| tags: ['v*'] | |
| release: | |
| types: [published] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest # 24.04 as of now | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| # Build with a modern Python; artifacts can still target older | |
| # versions if your package is pure-Python and metadata says so. | |
| python-version: '3.12.5' | |
| - run: python -m pip install --upgrade pip build | |
| - run: python -m build | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/* | |
| publish: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # Required for OIDC (Trusted Publishing) | |
| contents: read | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist | |
| - name: Publish to PyPI (Trusted Publishing) | |
| uses: pypa/gh-action-pypi-publish@v1.10.3 | |
| with: | |
| packages-dir: dist |