Skip to content

Commit 77f2fc9

Browse files
authored
Add publishing step for wheels to PyPI and GH Release
1 parent dc1e127 commit 77f2fc9

1 file changed

Lines changed: 41 additions & 1 deletion

File tree

.github/workflows/publish2.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,14 @@ jobs:
162162
uses: pypa/cibuildwheel@v2.23.0
163163
env:
164164
CIBW_ENVIRONMENT: "OMNIPKG_SKIP_C_EXT=0"
165+
CIBW_BUILD_VERBOSITY: 1
165166
CIBW_BEFORE_BUILD: "pip install 'packaging>=23.0'"
167+
# Pre-seed uv-ffi wheel into the test venv from the GH extra index
168+
# so pip never falls back to building it from the sdist (slow Rust build).
169+
CIBW_BEFORE_TEST: >
170+
pip install
171+
--extra-index-url https://1minds3t.github.io/uv-ffi/
172+
"uv-ffi>=0.10.8.post7"
166173
CIBW_BUILD: "${{ matrix.py_tag }}-*"
167174
CIBW_ARCHS: "${{ matrix.cibw_archs }}"
168175
CIBW_SKIP: "pp*"
@@ -210,4 +217,37 @@ jobs:
210217
with:
211218
name: wheels-noarch
212219
path: ./wheelhouse/*.whl
213-
if-no-files-found: error
220+
if-no-files-found: error
221+
publish:
222+
name: "Publish all wheels to PyPI + GH Release"
223+
needs: [build-wheels, build-noarch]
224+
runs-on: ubuntu-latest
225+
# Only publish when ref looks like a version tag (v3.1.1, v2.5.0, etc.).
226+
# Running from main, a branch, or a bare SHA -> skipped automatically.
227+
if: startsWith(inputs.ref, 'v')
228+
permissions:
229+
contents: write # required to upload assets to the GH Release
230+
id-token: write # required for PyPI trusted publishing (OIDC)
231+
steps:
232+
- name: Download all wheel artifacts
233+
uses: actions/download-artifact@v4
234+
with:
235+
pattern: wheels-*
236+
path: dist/
237+
merge-multiple: true
238+
239+
- name: List wheels to be published
240+
run: ls -lh dist/
241+
242+
- name: Upload wheels to GitHub Release
243+
uses: softprops/action-gh-release@v2
244+
with:
245+
tag_name: ${{ inputs.ref }}
246+
files: dist/*.whl
247+
fail_on_unmatched_files: true
248+
249+
- name: Publish to PyPI
250+
uses: pypa/gh-action-pypi-publish@release/v1
251+
with:
252+
packages-dir: dist/
253+
skip-existing: true # idempotent — safe to re-run if some already uploaded

0 commit comments

Comments
 (0)