|
4 | 4 | name: Release |
5 | 5 |
|
6 | 6 | # Always tests wheel building, but only publish to PyPI on pushed tags. |
| 7 | + |
7 | 8 | on: |
8 | 9 | pull_request: |
9 | 10 | paths-ignore: |
10 | 11 | - "docs/**" |
11 | | - - ".github/workflows/*.yaml" |
| 12 | + - "**.md" |
| 13 | + - ".github/workflows/*" |
12 | 14 | - "!.github/workflows/release.yaml" |
13 | 15 | push: |
14 | 16 | paths-ignore: |
15 | 17 | - "docs/**" |
16 | | - - ".github/workflows/*.yaml" |
| 18 | + - "**.md" |
| 19 | + - "**.rst" |
| 20 | + - ".github/workflows/*" |
17 | 21 | - "!.github/workflows/release.yaml" |
18 | 22 | branches-ignore: |
19 | 23 | - "dependabot/**" |
20 | 24 | - "pre-commit-ci-update-config" |
21 | | - tags: ["**"] |
| 25 | + tags: |
| 26 | + - "**" |
22 | 27 | workflow_dispatch: |
23 | 28 |
|
| 29 | +permissions: |
| 30 | + contents: read |
| 31 | + |
24 | 32 | jobs: |
25 | 33 | build-release: |
26 | | - runs-on: ubuntu-22.04 |
27 | | - permissions: |
28 | | - # id-token=write is required for pypa/gh-action-pypi-publish, and the PyPI |
29 | | - # project needs to be configured to trust this workflow. |
30 | | - # |
31 | | - # ref: https://github.com/jupyterhub/team-compass/issues/648 |
32 | | - # |
33 | | - id-token: write |
34 | | - |
| 34 | + runs-on: ubuntu-24.04 |
35 | 35 | steps: |
36 | | - - uses: actions/checkout@v6 |
37 | | - - uses: actions/setup-python@v6 |
| 36 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 37 | + with: |
| 38 | + persist-credentials: false |
| 39 | + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 |
38 | 40 | with: |
39 | | - python-version: "3.11" |
| 41 | + python-version: "3.13" |
40 | 42 |
|
41 | | - - name: install build package |
| 43 | + - name: install build requirements |
42 | 44 | run: | |
43 | | - pip install --upgrade pip |
44 | 45 | pip install build |
45 | 46 | pip freeze |
46 | 47 |
|
|
49 | 50 | python -m build --sdist --wheel . |
50 | 51 | ls -l dist |
51 | 52 |
|
52 | | - - name: publish to pypi |
53 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
54 | | - if: startsWith(github.ref, 'refs/tags/') |
| 53 | + - name: upload dists |
| 54 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 55 | + with: |
| 56 | + name: ${{ github.event.repository.name }}-dist |
| 57 | + path: dist/ |
| 58 | + |
| 59 | + pypi-publish: |
| 60 | + runs-on: ubuntu-24.04 |
| 61 | + if: startsWith(github.ref, 'refs/tags/') |
| 62 | + environment: |
| 63 | + name: release |
| 64 | + needs: |
| 65 | + - build-release |
| 66 | + permissions: |
| 67 | + id-token: write |
| 68 | + |
| 69 | + steps: |
| 70 | + - name: Get release artifacts |
| 71 | + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 72 | + with: |
| 73 | + name: ${{ github.event.repository.name }}-dist |
| 74 | + path: dist/ |
| 75 | + |
| 76 | + - name: Publish to PyPI |
| 77 | + uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1 |
0 commit comments