name: deploy-pypi

on:
  release:
    types: [published]

jobs:
  deploy-pypi:

    runs-on: ubuntu-latest
    strategy:
      max-parallel: 4
      matrix:
        python-version: [3.8]

    steps:
    - uses: actions/checkout@v1
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v1
      with:
        python-version: ${{ matrix.python-version }}
    - name: Fail build on non-release commits
      run: git describe --exact-match --tags HEAD
    - name: Install dependencies
      run: ci/install_dependencies.sh
    - name: Deploy
      run: |
        rm -rf dist/*
        python setup.py sdist bdist_wheel
        twine upload -u zasdfgbnm-bot -p ${{secrets.zasdfgbnm_bot_pypi_password}} dist/*
