v4.6.3 (#956) #5
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: PyPI Publish | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| workflow_dispatch: | |
| inputs: | |
| test_pypi: | |
| description: 'Publish to Test PyPI instead of PyPI' | |
| required: false | |
| default: false | |
| type: boolean | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| pypi-publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # Required for trusted publishing to PyPI | |
| steps: | |
| - name: Check Out Repo | |
| uses: actions/checkout@v5 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build twine | |
| - name: Build package | |
| run: python -m build | |
| - name: Verify package | |
| run: | | |
| python -m twine check dist/* | |
| ls -la dist/ | |
| - name: Publish to Test PyPI | |
| if: ${{ github.event.inputs.test_pypi == 'true' }} | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| # Option 1: Use trusted publishing (recommended) | |
| # Repository must be configured in Test PyPI with GitHub as trusted publisher | |
| # Option 2: Use API token (uncomment the line below and comment out the trusted publishing) | |
| # password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
| verbose: true | |
| skip-existing: true | |
| - name: Publish to PyPI | |
| if: ${{ github.event.inputs.test_pypi != 'true' }} | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| # Option 1: Use trusted publishing (recommended) | |
| # Repository must be configured in PyPI with GitHub as trusted publisher | |
| # Option 2: Use API token (uncomment the line below and comment out the trusted publishing) | |
| # password: ${{ secrets.PYPI_API_TOKEN }} | |
| verbose: true | |
| skip-existing: true |