|
14 | 14 | - main
|
15 | 15 | - maintenance/**
|
16 | 16 | push:
|
17 |
| - tags: |
18 |
| - - v* |
| 17 | + branches: |
| 18 | + - main # FOR TESTING ONLY |
19 | 19 | workflow_dispatch:
|
| 20 | + inputs: |
| 21 | + environment: |
| 22 | + description: Which PyPI environment to upload to, if any |
| 23 | + required: true |
| 24 | + type: choice |
| 25 | + options: ["none", "testpypi", "pypi"] |
20 | 26 |
|
21 | 27 | concurrency:
|
22 | 28 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
68 | 74 | python: "cp314t"
|
69 | 75 |
|
70 | 76 | env:
|
71 |
| - IS_32_BIT: ${{ matrix.buildplat[1] == 'win32' }} |
| 77 | + IS_32_BIT: ${{ matrix.buildplat[1] == 'win32' }} # used in a cibw_*.sh script |
| 78 | + |
72 | 79 | steps:
|
73 | 80 | - name: Checkout numpy-release
|
74 | 81 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
@@ -135,12 +142,12 @@ jobs:
|
135 | 142 | CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
|
136 | 143 | run: |
|
137 | 144 | python -m pip install cibuildwheel==3.1.0
|
138 |
| - python -m cibuildwheel numpy-src --config-file cibuildwheel.toml --output-dir ./wheelhouse |
| 145 | + python -m cibuildwheel numpy-src --config-file cibuildwheel.toml --output-dir ./dist |
139 | 146 |
|
140 | 147 | - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
141 | 148 | with:
|
142 | 149 | name: ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
|
143 |
| - path: ./wheelhouse/*.whl |
| 150 | + path: ./dist/*.whl |
144 | 151 |
|
145 | 152 | build_sdist:
|
146 | 153 | name: Build sdist
|
@@ -171,36 +178,47 @@ jobs:
|
171 | 178 | path: ./dist/*
|
172 | 179 |
|
173 | 180 | testpypi-publish:
|
174 |
| - name: Upload release to TestPyPI |
175 |
| - if: # TODO - add a release True/False? and on `main`? |
| 181 | + name: Publish release to TestPyPI |
| 182 | + if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'testpypi' |
176 | 183 | needs: [build_wheels, build_sdist]
|
177 | 184 | runs-on: ubuntu-latest
|
178 | 185 | environment:
|
179 |
| - name: pypi |
180 |
| - url: https://pypi.org/p/numpy |
| 186 | + name: testpypi |
| 187 | + url: https://test.pypi.org/p/numpy |
181 | 188 | permissions:
|
182 |
| - id-token: write |
| 189 | + id-token: write # mandatory for trusted publishing |
183 | 190 | steps:
|
184 |
| - # TODO: retrieve your distributions here |
| 191 | + - name: Download sdist and wheels |
| 192 | + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v.4.3.0 |
| 193 | + with: |
| 194 | + path: dist |
185 | 195 |
|
186 |
| - - name: Publish package distributions to PyPI |
187 |
| - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 |
188 |
| - with: |
189 |
| - print-hash: true |
| 196 | + - name: Publish |
| 197 | + uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 |
| 198 | + with: |
| 199 | + repository-url: https://test.pypi.org/legacy/ |
| 200 | + skip-existing: true |
| 201 | + print-hash: true |
| 202 | + attestations: true |
190 | 203 |
|
191 | 204 | pypi-publish:
|
192 |
| - name: Upload release to PyPI |
| 205 | + name: Publish release to PyPI |
| 206 | + if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi' |
193 | 207 | needs: [build_wheels, build_sdist]
|
194 | 208 | runs-on: ubuntu-latest
|
195 | 209 | environment:
|
196 | 210 | name: pypi
|
197 | 211 | url: https://pypi.org/p/numpy
|
198 | 212 | permissions:
|
199 |
| - id-token: write |
| 213 | + id-token: write # mandatory for trusted publishing |
200 | 214 | steps:
|
201 |
| - # TODO: retrieve your distributions here |
| 215 | + - name: Download sdist and wheels |
| 216 | + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v.4.3.0 |
| 217 | + with: |
| 218 | + path: dist |
202 | 219 |
|
203 |
| - - name: Publish package distributions to PyPI |
204 |
| - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 |
205 |
| - with: |
206 |
| - print-hash: true |
| 220 | + - name: Publish |
| 221 | + uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 |
| 222 | + with: |
| 223 | + print-hash: true |
| 224 | + attestations: true |
0 commit comments