Skip to content

Commit

Permalink
github action: build/upload as two steps
Browse files Browse the repository at this point in the history
  • Loading branch information
kno10 committed Jun 15, 2022
1 parent 9b6a3c7 commit 1b24f4d
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
workflow_dispatch:

jobs:
pypi:
name: PyPI
build-wheels:
name: Build wheels for PyPI
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
Expand All @@ -18,19 +18,19 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

# install pip prerequisites
- name: Install cffi and virtualenv
run: pip install cffi virtualenv

# install rust toolchoin
- uses: actions-rs/toolchain@v1
id: rustup
with:
profile: minimal
toolchain: stable
override: true

# setup macOS as in the maturin tests, see:
# https://github.com/PyO3/maturin/blob/main/.github/workflows/test.yml
- name: Install aarch64-apple-darwin Rust target
Expand All @@ -45,20 +45,41 @@ jobs:
echo "CC=${bindir}/clang" >> "${GITHUB_ENV}"
echo "CXX=${bindir}/clang++" >> "${GITHUB_ENV}"
echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> "${GITHUB_ENV}"
# setup linux
- name: Install musl tools
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y musl-tools

# build and publish
- name: Install Python dependencies
run: pip install maturin
- name: Build wheels
run: maturin build --release --strip
- uses: actions/upload-artifact@v3
with:
name: wheels
path: target/wheels/
if-no-files-found: error

upload-wheels:
name: Upload wheels to PyPI
needs: build-wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/download-artifact@v3
with:
name: wheels
path: wheels/
- name: list contents
run: ls -R
working-directory: wheels/
- name: publish
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: target/wheels/
packages_dir: wheels/

0 comments on commit 1b24f4d

Please sign in to comment.