Publish to PyPI #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to PyPI | |
on: | |
push: | |
tags: | |
- "*" | |
workflow_dispatch: | |
jobs: | |
download-sources: | |
name: Download and store sources | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Download external sources | |
run: | | |
make prepare-src | |
make download-sqlite | |
make download-sqlite3_arabic_tokenizer | |
- name: Store sources | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sources | |
path: | | |
MANIFEST.in | |
Makefile | |
README.md | |
setup.cfg | |
setup.py | |
sqlite3_arabic_tokenizer | |
src | |
sqlite | |
test | |
sdist: | |
name: Build sdist | |
runs-on: ubuntu-latest | |
needs: download-sources | |
steps: | |
- name: Download sources | |
uses: actions/download-artifact@v3 | |
with: | |
name: sources | |
- name: Build sdist | |
run: pipx run build --sdist | |
- name: Store sdist | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
build: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: download-sources | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
steps: | |
- name: Download sources | |
uses: actions/download-artifact@v3 | |
with: | |
name: sources | |
# only initialize QEMU on Linux, other platforms don't need it | |
- name: Set up QEMU to add multiplatform support | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
# architectures: | |
# - 64-bit linux (x86_64/i686/aarch64/ppc64le/s390x) | |
# - 64-bit windows (AMD64/x86/ARM64) | |
# - 64-bit macos (x86_64/arm64/universal2) | |
CIBW_ARCHS_LINUX: x86_64 aarch64 | |
CIBW_ARCHS_WINDOWS: AMD64 ARM64 | |
CIBW_ARCHS_MACOS: x86_64 arm64 | |
# disable builds: | |
# - unsupported python versions | |
# - musllinux | |
# - pypy | |
CIBW_SKIP: "cp36-* cp37-* *-musllinux_* pp*" | |
- name: Store wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
publish: | |
name: Publish to PyPI | |
needs: [build, sdist] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
permissions: | |
id-token: write | |
steps: | |
- name: Download wheels | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |