| 1 | name: publish |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | tags: |
| 6 | - '[0-9]+.[0-9]+.[0-9]+' |
| 7 | |
| 8 | concurrency: |
| 9 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} |
| 10 | cancel-in-progress: true |
| 11 | |
| 12 | jobs: |
| 13 | build: |
| 14 | name: Build a pure Python wheel and source distribution |
| 15 | runs-on: ubuntu-latest |
| 16 | |
| 17 | steps: |
| 18 | - uses: actions/checkout@v4 |
| 19 | |
| 20 | - name: Install build dependencies |
| 21 | run: python -m pip install --upgrade build |
| 22 | |
| 23 | - name: Build |
| 24 | run: python -m build |
| 25 | |
| 26 | - uses: actions/upload-artifact@v3 |
| 27 | with: |
| 28 | name: artifacts |
| 29 | path: dist/* |
| 30 | if-no-files-found: error |
| 31 | |
| 32 | publish: |
| 33 | name: Publish release |
| 34 | runs-on: ubuntu-latest |
| 35 | needs: |
| 36 | - build |
| 37 | |
| 38 | steps: |
| 39 | - uses: actions/download-artifact@v3 |
| 40 | with: |
| 41 | name: artifacts |
| 42 | path: dist |
| 43 | |
| 44 | - name: Push build artifacts to PyPI |
| 45 | uses: pypa/[email protected] |
| 46 | with: |
| 47 | skip_existing: true |
| 48 | user: __token__ |
| 49 | password: ${{ secrets.PYPI_API_TOKEN }} |