Skip to content

Commit 1b24f4d

Browse files
committed
github action: build/upload as two steps
1 parent 9b6a3c7 commit 1b24f4d

1 file changed

Lines changed: 29 additions & 8 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ on:
55
workflow_dispatch:
66

77
jobs:
8-
pypi:
9-
name: PyPI
8+
build-wheels:
9+
name: Build wheels for PyPI
1010
strategy:
1111
matrix:
1212
os: [ ubuntu-latest, macos-latest, windows-latest ]
@@ -18,19 +18,19 @@ jobs:
1818
- uses: actions/setup-python@v2
1919
with:
2020
python-version: ${{ matrix.python-version }}
21-
21+
2222
# install pip prerequisites
2323
- name: Install cffi and virtualenv
2424
run: pip install cffi virtualenv
25-
25+
2626
# install rust toolchoin
2727
- uses: actions-rs/toolchain@v1
2828
id: rustup
2929
with:
3030
profile: minimal
3131
toolchain: stable
3232
override: true
33-
33+
3434
# setup macOS as in the maturin tests, see:
3535
# https://github.com/PyO3/maturin/blob/main/.github/workflows/test.yml
3636
- name: Install aarch64-apple-darwin Rust target
@@ -45,20 +45,41 @@ jobs:
4545
echo "CC=${bindir}/clang" >> "${GITHUB_ENV}"
4646
echo "CXX=${bindir}/clang++" >> "${GITHUB_ENV}"
4747
echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> "${GITHUB_ENV}"
48-
48+
4949
# setup linux
5050
- name: Install musl tools
5151
if: matrix.os == 'ubuntu-latest'
5252
run: sudo apt-get install -y musl-tools
53-
53+
5454
# build and publish
5555
- name: Install Python dependencies
5656
run: pip install maturin
5757
- name: Build wheels
5858
run: maturin build --release --strip
59+
- uses: actions/upload-artifact@v3
60+
with:
61+
name: wheels
62+
path: target/wheels/
63+
if-no-files-found: error
64+
65+
upload-wheels:
66+
name: Upload wheels to PyPI
67+
needs: build-wheels
68+
runs-on: ubuntu-latest
69+
steps:
70+
- uses: actions/checkout@v2
71+
- uses: actions/setup-python@v1
72+
- uses: actions/download-artifact@v3
73+
with:
74+
name: wheels
75+
path: wheels/
76+
- name: list contents
77+
run: ls -R
78+
working-directory: wheels/
5979
- name: publish
6080
uses: pypa/gh-action-pypi-publish@master
6181
with:
6282
user: __token__
6383
password: ${{ secrets.PYPI_TOKEN }}
64-
packages_dir: target/wheels/
84+
packages_dir: wheels/
85+

0 commit comments

Comments
 (0)