From 4d12a4ee4972d9474e6e3becb70e6fb02ff1be46 Mon Sep 17 00:00:00 2001 From: Arjan Zijderveld <5286904+arjanz@users.noreply.github.com> Date: Fri, 4 Jun 2021 14:34:16 +0200 Subject: [PATCH] Deploy to PyPI Github action --- .github/workflows/pypi.yml | 136 +++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 .github/workflows/pypi.yml diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..5d0a330 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,136 @@ +name: Deploy to PyPI + +on: + release: + types: [ created ] + +jobs: + macos: + strategy: + matrix: + python-version: + - '3.6' + - '3.7' + - '3.8' + - '3.9' + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + architecture: x64 + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + profile: minimal + override: true + default: true + - name: Build wheels - x86_64 + uses: messense/maturin-action@v1 + with: + maturin-version: latest + target: x86_64 + args: --release --out dist + - name: Build wheels - universal2 + uses: messense/maturin-action@v1 + with: + args: --release --universal2 --out dist --no-sdist + - name: Upload wheels + uses: actions/upload-artifact@v2 + with: + name: wheels + path: dist + + windows: + runs-on: windows-latest + strategy: + matrix: + target: [x64, x86] + python-version: + - '3.6' + - '3.7' + - '3.8' + - '3.9' + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.target }} + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + profile: minimal + override: true + default: true + - name: Build wheels + uses: messense/maturin-action@v1 + with: + maturin-version: latest + target: ${{ matrix.target }} + args: --release --out dist --no-sdist + - name: Upload wheels + uses: actions/upload-artifact@v2 + with: + name: wheels + path: dist + + linux: + runs-on: ubuntu-latest + strategy: + matrix: + target: [x86_64] + python-version: + - '3.6' + - '3.7' + - '3.8' + - '3.9' + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + architecture: x64 + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + profile: minimal + override: true + default: true + - name: Build Wheels + uses: messense/maturin-action@v1 + with: + maturin-version: latest + target: ${{ matrix.target }} + args: --release --out dist --no-sdist + container: off + manylinux: auto + - name: Upload wheels + uses: actions/upload-artifact@v2 + with: + name: wheels + path: dist + + release: + name: Release + runs-on: ubuntu-latest + if: "startsWith(github.ref, 'refs/tags/')" + needs: [ macos, windows, linux] + steps: + - uses: actions/download-artifact@v2 + with: + name: wheels + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Publish to PyPi + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + pip install --upgrade twine + twine upload --skip-existing *