|
7 | 7 | - "v*.*.*" |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - build-and-publish-to-pypi: |
11 | | - name: Build and publish library to PyPI |
12 | | - runs-on: ubuntu-22.04 |
| 10 | + build-pypi-distribs: |
| 11 | + name: Build for publishing |
| 12 | + runs-on: ubuntu-24.04 |
| 13 | + permissions: |
| 14 | + contents: read |
| 15 | + |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 18 | + - name: Set up Python |
| 19 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 20 | + with: |
| 21 | + python-version: 3.10 |
| 22 | + |
| 23 | + - name: Install pypa/build |
| 24 | + run: python -m pip install build --user |
| 25 | + |
| 26 | + - name: Build a binary wheel and a source tarball |
| 27 | + run: python -m build --sdist --wheel --outdir dist/ |
| 28 | + |
| 29 | + - name: Upload built archives |
| 30 | + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 |
| 31 | + with: |
| 32 | + name: pypi_archives |
| 33 | + path: dist/* |
| 34 | + |
| 35 | + create-gh-release: |
| 36 | + name: Create GH release |
| 37 | + needs: |
| 38 | + - build-pypi-distribs |
| 39 | + runs-on: ubuntu-24.04 |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Download built archives |
| 43 | + uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 |
| 44 | + with: |
| 45 | + name: pypi_archives |
| 46 | + path: dist |
| 47 | + |
| 48 | + - name: Create GH release |
| 49 | + uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 |
| 50 | + with: |
| 51 | + draft: false |
| 52 | + generate_release_notes: true |
| 53 | + files: dist/* |
| 54 | + |
| 55 | + create-pypi-release: |
| 56 | + name: Create PyPI release |
| 57 | + needs: |
| 58 | + - create-gh-release |
| 59 | + runs-on: ubuntu-24.04 |
| 60 | + environment: pypi-publish |
| 61 | + permissions: |
| 62 | + id-token: write |
| 63 | + |
13 | 64 | steps: |
14 | | - - uses: actions/checkout@v4 |
15 | | - - name: Set up Python |
16 | | - uses: actions/setup-python@v5 |
17 | | - with: |
18 | | - python-version: 3.9 |
19 | | - - name: Install pypa/build |
20 | | - run: python -m pip install build --user |
21 | | - - name: Build a binary wheel and a source tarball |
22 | | - run: python -m build --sdist --wheel --outdir dist/ |
23 | | - - name: Publish distribution to PyPI |
24 | | - if: startsWith(github.ref, 'refs/tags') |
25 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
26 | | - with: |
27 | | - password: ${{ secrets.PYPI_API_TOKEN }} |
28 | | - |
| 65 | + - name: Download built archives |
| 66 | + uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 |
| 67 | + with: |
| 68 | + name: pypi_archives |
| 69 | + path: dist |
| 70 | + |
| 71 | + - name: Publish to PyPI |
| 72 | + if: startsWith(github.ref, 'refs/tags/') |
| 73 | + uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 |
| 74 | + with: |
| 75 | + verbose: true |
0 commit comments