name: Python release

on:
  push:
    tags: [ '**' ]

jobs:
  deploy:
    if: ${{ github.event.base_ref == 'refs/heads/master' || contains(github.ref, '.dev') }}
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python 3.x
      uses: actions/setup-python@v2
      with:
        python-version: '3.x'
    - name: Prepare distribution
      run: |
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install setuptools wheel twine
    - name: Build package
      run: |
        python setup.py sdist bdist_wheel
    - name: Publish distribution to PyPI
      if: startsWith(github.ref, 'refs/tags')
      uses: pypa/gh-action-pypi-publish@master
      with:
        password: ${{ secrets.PYPI_TOKEN }}
