Skip to content

Commit 28d20b2

Browse files
committed
ci: publish python wheels on release
1 parent 54b6026 commit 28d20b2

File tree

1 file changed

+40
-3
lines changed

1 file changed

+40
-3
lines changed

.github/workflows/python-wheels.yml

+40-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
python-version: [
2323
'3.10',
2424
'3.11',
25-
'3.12'
25+
'3.12',
2626
] # see https://devguide.python.org/versions/
2727

2828
steps:
@@ -42,12 +42,49 @@ jobs:
4242
- name: Install maturin
4343
run: python -m pip install maturin
4444

45+
- name: Build source distribution # do this only once
46+
run: |
47+
cd lakers-python
48+
maturin build --sdist --out wheelhouse
49+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
50+
4551
- name: Build wheels
4652
run: |
4753
cd lakers-python
48-
maturin build --out wheelhouse
54+
maturin build --release --out wheelhouse
4955
5056
- uses: actions/upload-artifact@v4
5157
with:
5258
name: wheel-${{ matrix.os }}-python-${{ matrix.python-version }}
53-
path: ./lakers-python/wheelhouse/*.whl
59+
path: ./lakers-python/wheelhouse/lakers_python*
60+
61+
release:
62+
runs-on: ubuntu-latest
63+
needs: [build-python-wheels]
64+
# if: >-
65+
# github.event_name == 'push' &&
66+
# startsWith(github.event.ref, 'refs/tags')
67+
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- name: set up python
72+
uses: actions/setup-python@v5
73+
with:
74+
python-version: '3.10'
75+
76+
- run: pip install -U twine
77+
78+
- name: get wheelhouse artifacts
79+
uses: actions/download-artifact@v4
80+
with:
81+
path: wheelhouse
82+
83+
- run: ls -lah ./wheelhouse/*/lakers_python*
84+
- run: twine check ./wheelhouse/*/lakers_python*
85+
86+
- name: upload to pypi
87+
run: twine upload ./wheelhouse/*/lakers_python*
88+
env:
89+
TWINE_USERNAME: __token__
90+
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_TOKEN }}

0 commit comments

Comments
 (0)