Publish to PyPI #193
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 to PyPI | |
| # on manually trigger | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| scope: | |
| description: Release scope | |
| required: true | |
| default: minor | |
| type: choice | |
| options: | |
| - major | |
| - minor | |
| - patch | |
| jobs: | |
| check: | |
| uses: ./.github/workflows/checks.yml | |
| secrets: inherit | |
| publish: | |
| needs: [check] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.9' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install dependencies | |
| run: | | |
| uv sync --all-extras --group ci --python 3.9 | |
| - name: Bump version and commit change | |
| run: | | |
| source .venv/bin/activate | |
| semantic-release version --${{ github.event.inputs.scope }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and publish | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
| run: | | |
| source .venv/bin/activate | |
| python -m build | |
| python -m twine upload dist/* |