Skip to content

Commit c38bf3f

Browse files
committed
Split up release workflow into multiple jobs
1 parent 05cd87f commit c38bf3f

File tree

1 file changed

+41
-6
lines changed

1 file changed

+41
-6
lines changed

.github/workflows/release.yml

+41-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
name: Upload Python Package
1+
name: Build Python wheels
22

33
on:
4+
push:
5+
branches:
6+
- main
47
release:
58
types: [published]
69

710
permissions:
811
contents: read
912

1013
jobs:
11-
deploy:
14+
build_wheels:
1215
runs-on: ${{ matrix.os }}
1316
strategy:
1417
matrix:
@@ -27,12 +30,44 @@ jobs:
2730
python -m pip install --upgrade pip
2831
pip install build cibuildwheel==2.20.0
2932
30-
- name: Build package
33+
- name: Build wheels
3134
run: python -m cibuildwheel
3235

33-
- name: Publish package
34-
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0
36+
- uses: actions/upload-artifact@v4
37+
with:
38+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
39+
path: ./wheelhouse/*.whl
40+
41+
build_sdist:
42+
name: Build source distribution
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
47+
- name: Build sdist
48+
run: pipx run build --sdist
49+
50+
- uses: actions/upload-artifact@v4
51+
with:
52+
name: cibw-sdist
53+
path: dist/*.tar.gz
54+
55+
upload_pypi:
56+
needs: [build_wheels, build_sdist]
57+
runs-on: ubuntu-latest
58+
environment: pypi
59+
permissions:
60+
id-token: write
61+
if: github.event_name == 'release' && github.event.action == 'published'
62+
63+
steps:
64+
- uses: actions/download-artifact@v4
65+
with:
66+
pattern: cibw-*
67+
path: dist
68+
merge-multiple: true
69+
70+
- uses: pypa/gh-action-pypi-publish@release/v1
3571
with:
3672
user: __token__
3773
password: ${{ secrets.PYPI_API_TOKEN }}
38-
packages_dir: ./wheelhouse/

0 commit comments

Comments
 (0)