name: upload-wheel

on:
  push:
    tags:
      - "2.*"

  workflow_dispatch:
    inputs:
      tags:
        description: 'Tag for wheel'


jobs:
  build-and-upload:
    runs-on: ${{ matrix.os }}-latest
    strategy:
      fail-fast: false
      matrix:
        python: ['3.6', '3.7', '3.8', '3.9']
        os: [windows, macos]
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python }}
      - name: Display Python version
        run: python -c "import sys; print(sys.version)"
      - run: python -m pip install wheel twine
      - run: python setup.py bdist_wheel
      - run: twine upload dist/*.whl
        env:
          TWINE_USERNAME: __token__
          TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
