name: Wheels

on:
  push:
    branches: [main]
    tags: ["v*.*.*"]
  pull_request:
    branches: [main]
  release:
    types:
      - published

jobs:
  build_sdist:
    name: Build sdist
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
      with:
        submodules: true
    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: "3.x"
    - name: Build sdist
      run: pipx run --spec build pyproject-build --sdist
    - name: Check sdist metadata
      run: pipx run twine check dist/*.tar.gz
    - uses: actions/upload-artifact@v2
      with:
        path: dist/*.tar.gz

  build_wheels:
    name: Build wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
    env:
      CIBW_ARCHS_LINUX: x86_64
      CIBW_ARCHS_MACOS: x86_64 universal2
      # Building for one python version is enough, since this is a
      # ctypes-based 'universal binary wheel' (py3-none-*) not
      # linked to a specific python version or implementation.
      CIBW_BUILD: "cp39-*"
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: recursive
          fetch-depth: 0
      - uses: actions/setup-python@v2
        with:
          python-version: 3.9
      - name: Build wheels
        run: pipx run cibuildwheel --output-dir dist
      - uses: actions/upload-artifact@v2
        with:
          path: dist/*.whl

  deploy:
    name: Upload if release
    needs: [build_sdist, build_wheels]
    runs-on: ubuntu-latest
    if: github.event_name == 'release' && github.event.action == 'published'

    steps:
    - uses: actions/download-artifact@v2
      with:
        name: artifact
        path: dist

    - uses: pypa/gh-action-pypi-publish@v1.4.2
      with:
        user: __token__
        password: ${{ secrets.PYPI_PASSWORD }}

Add github actions and cibuildwheel setup
Add github actions and cibuildwheel setup
