|
4 | 4 | release: |
5 | 5 | types: [published] |
6 | 6 |
|
| 7 | +# Restrict default permissions for all jobs |
| 8 | +permissions: {} |
| 9 | + |
7 | 10 | jobs: |
8 | | - deploy: |
| 11 | + build: |
| 12 | + name: Build distribution |
9 | 13 | runs-on: ubuntu-latest |
| 14 | + permissions: |
| 15 | + contents: read |
10 | 16 | steps: |
11 | | - - uses: actions/checkout@v6 |
| 17 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 18 | + with: |
| 19 | + persist-credentials: false |
12 | 20 | - name: Set up Python |
13 | | - uses: actions/setup-python@v6 |
| 21 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 22 | + with: |
| 23 | + python-version: "3.x" |
| 24 | + - name: Install build dependencies |
| 25 | + run: python -m pip install --upgrade pip build |
| 26 | + - name: Build package |
| 27 | + run: python -m build |
| 28 | + - name: Upload distribution artifacts |
| 29 | + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 |
| 30 | + with: |
| 31 | + name: python-package-distributions |
| 32 | + path: dist/ |
| 33 | + |
| 34 | + publish: |
| 35 | + name: Publish to PyPI |
| 36 | + needs: build |
| 37 | + runs-on: ubuntu-latest |
| 38 | + environment: |
| 39 | + name: pypi |
| 40 | + permissions: |
| 41 | + id-token: write |
| 42 | + steps: |
| 43 | + - name: Download distribution artifacts |
| 44 | + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 45 | + with: |
| 46 | + name: python-package-distributions |
| 47 | + path: dist/ |
| 48 | + - name: Publish package to PyPI |
| 49 | + uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 |
| 50 | + |
| 51 | + post-release: |
| 52 | + name: Trigger documentation rebuilds |
| 53 | + needs: publish |
| 54 | + runs-on: ubuntu-latest |
| 55 | + environment: rtd-rebuild |
| 56 | + permissions: |
| 57 | + contents: read |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 60 | + with: |
| 61 | + persist-credentials: false |
| 62 | + - name: Set up Python |
| 63 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
14 | 64 | with: |
15 | 65 | python-version: "3.x" |
16 | | - - name: Install dependencies |
17 | | - run: | |
18 | | - python -m pip install --upgrade pip |
19 | | - python -m pip install -U --user --force-reinstall pep517 setuptools_scm twine |
20 | | - - name: Build and publish |
21 | | - env: |
22 | | - TWINE_USERNAME: __token__ |
23 | | - TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_TOKEN }} |
24 | | - run: | |
25 | | - python -m pep517.build --binary --source --out-dir wheelhouse . |
26 | | - python -m twine upload --skip-existing wheelhouse/* |
27 | | - - name: Install dependencies |
28 | | - run: | |
29 | | - pip install requests httpie |
30 | 66 | - name: Build all RTD versions |
31 | 67 | env: |
32 | 68 | RTD_AUTH_TOKEN: ${{ secrets.RTD_AUTH_TOKEN }} |
33 | | - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
34 | | - run: | |
35 | | - python tools/rebuild_all_rtd.py |
36 | | - http POST https://api.netlify.com/api/v1/sites/1ba3a6d4-f1ee-4524-bbec-3edc04720a48/builds "Authorization: Bearer $NETLIFY_AUTH_TOKEN" |
| 69 | + run: pipx run tools/rebuild_all_rtd.py |
0 commit comments