|
9 | 9 | description: "Publish to PyPi" |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - build_for_pypi: |
13 | | - permissions: |
14 | | - id-token: write # This is required for requesting the JWT |
15 | | - contents: read # This is required for actions/checkout |
| 12 | + build_dist_for_pypi: |
16 | 13 | runs-on: ${{ matrix.os }} |
17 | 14 | strategy: |
18 | 15 | matrix: |
19 | 16 | os: [ubuntu-latest, windows-latest, macos-13, macos-latest] |
20 | 17 | steps: |
21 | 18 | - uses: actions/checkout@v4 |
22 | 19 | with: |
| 20 | + persist-credentials: false |
23 | 21 | submodules: true |
24 | 22 | - name: Set up Python 3.11 |
25 | 23 | uses: actions/setup-python@v4 |
|
29 | 27 | |
30 | 28 | env: |
31 | 29 | CIBW_SKIP: pp* |
| 30 | + - name: Store the distribution packages |
| 31 | + uses: actions/upload-artifact@v4 |
| 32 | + with: |
| 33 | + name: python-package-distributions |
| 34 | + path: dist/ |
| 35 | + |
| 36 | + build_src_for_pypi: |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v4 |
| 40 | + with: |
| 41 | + persist-credentials: false |
| 42 | + submodules: true |
| 43 | + - name: Set up Python 3.11 |
| 44 | + uses: actions/setup-python@v4 |
| 45 | + with: |
| 46 | + python-version: "3.11" |
| 47 | + - name: Install deps |
| 48 | + run: |
| 49 | + pip install -r requirements.txt |
| 50 | + pip install build |
| 51 | + - name: Build src dist |
| 52 | + run: | |
| 53 | + python -m build --sdist |
| 54 | + - name: Store the distribution packages |
| 55 | + uses: actions/upload-artifact@v4 |
| 56 | + with: |
| 57 | + name: python-package-distributions |
| 58 | + path: dist/ |
| 59 | + |
| 60 | + publish_to_pypi: |
| 61 | + needs: |
| 62 | + - build_for_pypi |
| 63 | + - build_src_for_pypi |
| 64 | + permissions: |
| 65 | + id-token: write # This is required for requesting the JWT |
| 66 | + runs-on: ubuntu-latest |
| 67 | + steps: |
| 68 | + - name: Download all the dists |
| 69 | + uses: actions/download-artifact@v4 |
| 70 | + with: |
| 71 | + name: python-package-distributions |
| 72 | + path: dist/ |
| 73 | + - name: Sign the dists with Sigstore |
| 74 | + |
| 75 | + with: |
| 76 | + inputs: >- |
| 77 | + ./dist/*.tar.gz |
| 78 | + ./dist/*.whl |
| 79 | + - name: Display all files in dist/ |
| 80 | + run: | |
| 81 | + ls -al dist/ |
32 | 82 | - name: Publish package to PyPi |
33 | 83 | if: inputs.publish == true |
34 | 84 | uses: pypa/gh-action-pypi-publish@release/v1 |
|
0 commit comments