name: deploy-pypi

on:
  release:
    types: [published]

jobs:
  build:

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

    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: |
        python -m pip install --upgrade pip
        pip install twine wheel
    - name: Deploy
      run: |
        rm -rf dist/*
        git tag $(date +'v%Y.%m.%d.%H.%M.%S')
        python setup.py bdist bdist_wheel
        twine upload -u zasdfgbnm-bot -p ${{secrets.zasdfgbnm_bot_pypi_password}} dist/*
