11name : Build and upload to PyPI
22
33on :
4- workflow_dispatch :
54 release :
6- types :
7- - published
5+ types : [published]
86
9- jobs :
10- build_wheels :
11- name : Build wheels on ${{ matrix.os }}
12- runs-on : ${{ matrix.os }}
13- strategy :
14- matrix :
15- # macos-13 is an intel runner, macos-14 is apple silicon
16- os : [ubuntu-latest]
17-
18- steps :
19- - uses : actions/checkout@v4
7+ permissions :
8+ contents : read
209
21- - name : Build wheels
22- 23-
24- - uses : actions/upload-artifact@v4
25- with :
26- name : cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
27- path : ./wheelhouse/*.whl
10+ jobs :
11+ deploy :
2812
29- build_sdist :
30- name : Build source distribution
3113 runs-on : ubuntu-latest
32- steps :
33- - uses : actions/checkout@v4
34-
35- - name : Build sdist
36- run : pipx run build --sdist
37-
38- - uses : actions/upload-artifact@v4
39- with :
40- name : cibw-sdist
41- path : dist/*.tar.gz
4214
43- upload_pypi :
44- needs : [build_wheels, build_sdist]
45- runs-on : ubuntu-latest
46- environment : pypi
47- permissions :
48- id-token : write
49- if : github.event_name == 'release' && github.event.action == 'published'
5015 steps :
51- - uses : actions/download-artifact@v4
52- with :
53- # unpacks all CIBW artifacts into dist/
54- pattern : cibw-*
55- path : dist
56- merge-multiple : true
57-
58- - uses : pypa/gh-action-pypi-publish@release/v1
59- with :
60- password : ${{ secrets.PYPI_API_TOKEN }}
16+ - uses : actions/checkout@v4
17+ - name : Set up Python
18+ uses : actions/setup-python@v3
19+ with :
20+ python-version : ' 3.x'
21+ - name : Install dependencies
22+ run : |
23+ python -m pip install --upgrade pip
24+ pip install build
25+ - name : Build package
26+ run : python -m build
27+ - name : Publish package
28+ uses : pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
29+ with :
30+ user : __token__
31+ password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments