name: publish-python-package
on:
push:
tags:
- 'v*'
jobs:
publish_crates:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- run: rustup update
- run: cargo login $CRATES_IO_TOKEN
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
- run: cargo publish
continue-on-error: true
- run: cargo publish
continue-on-error: true
publish_pypi_linux:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [ "x86_64", "aarch64" ]
poetry-version: ["1.1.15"]
continue-on-error: true
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: docker/setup-qemu-action@v2
with:
platforms: linux/${{ matrix.architecture }}
if: matrix.architecture != 'x86_64'
- run: sed 's/%arch%/${{ matrix.architecture }}/g' .github/workflows/manylinux_build.sh > .github/workflows/manylinux_build_script.sh
- run: docker run -v "$(pwd)":/workdir --platform linux/${{ matrix.architecture }} quay.io/pypa/manylinux2014_${{ matrix.architecture }} /bin/bash /workdir/.github/workflows/manylinux_build_script.sh
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: target/wheels
- uses: softprops/action-gh-release@v1
with:
files: target/wheels/*.whl
publish_pypi_mac:
runs-on: macos-latest
strategy:
matrix:
poetry-version: ["1.1.15"]
env:
DEVELOPER_DIR: '/Applications/Xcode.app/Contents/Developer'
SDKROOT: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'
MACOSX_DEPLOYMENT_TARGET: '10.14'
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: rustup update && rustup target add aarch64-apple-darwin
- name: install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- run: poetry install
- run: poetry run maturin build --release -m Cargo.toml -F python
- run: pip install --no-index --find-links=target/wheels/ reasonable
- run: poetry run python -c "import reasonable"
- run: rm -r target/wheels
- run: poetry run maturin publish --no-sdist --universal2 -m Cargo.toml -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} -F python
- run: poetry run maturin publish --no-sdist -m Cargo.toml -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} -F python
- uses: softprops/action-gh-release@v1
with:
files: target/wheels/*.whl
publish_pypi_windows:
runs-on: windows-latest
strategy:
matrix:
poetry-version: ["1.1.15"]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: rustup update
- run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse
- name: install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- run: poetry install
- run: poetry run maturin build --release -m Cargo.toml -F python
- run: pip install --no-index --find-links=target/wheels/ reasonable
- run: poetry run python -c "import reasonable"
- run: rm -r target/wheels
- run: poetry run maturin publish --no-sdist -m Cargo.toml -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} -F python
- uses: softprops/action-gh-release@v1
with:
files: target/wheels/*.whl
publish_pypi_stdist:
runs-on: ubuntu-latest
strategy:
matrix:
poetry-version: ["1.1.15"]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: rustup update
- name: install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- run: poetry install
- run: poetry run maturin build --release -m Cargo.toml -F python
- run: pip install --no-index --find-links=target/wheels/ reasonable
- run: poetry run python -c "import reasonable"
- run: rm -r target/wheels
- run: poetry run maturin sdist -m Cargo.toml
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: target/wheels
- uses: softprops/action-gh-release@v1
with:
files: target/wheels/*.tar.gz