Skip to content

Commit b4e59f1

Browse files
committed
Try to get cibuildwheel uploading to pypi
1 parent 565a856 commit b4e59f1

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

.github/workflows/cibuildwheel.yml

+37-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Build
22

3-
on: [pull_request]
3+
on:
4+
release:
5+
types:
6+
- published
47

58
jobs:
69
build_wheels:
@@ -28,3 +31,36 @@ jobs:
2831
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
2932
path: ./wheelhouse/*.whl
3033

34+
build_sdist:
35+
name: Build source distribution
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Build sdist
41+
run: pipx run build --sdist
42+
43+
- uses: actions/upload-artifact@v4
44+
with:
45+
name: cibw-sdist
46+
path: dist/*.tar.gz
47+
upload_pypi:
48+
needs: [build_wheels, build_sdist]
49+
runs-on: ubuntu-latest
50+
environment: pypi
51+
permissions:
52+
id-token: write
53+
if: github.event_name == 'release' && github.event.action == 'published'
54+
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
55+
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
56+
steps:
57+
- uses: actions/download-artifact@v4
58+
with:
59+
# unpacks all CIBW artifacts into dist/
60+
pattern: cibw-*
61+
path: dist
62+
merge-multiple: true
63+
64+
- uses: pypa/gh-action-pypi-publish@release/v1
65+
with:
66+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)