name: Release
on:
  release:
    types: [published]
jobs:
  build-and-publish:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        ref: ${{ github.event.release.tag_name }}
    - name: Set up Python
      uses: actions/setup-python@v2
    - name: Install build dependencies
      run: pip install -U setuptools wheel build
    - name: Build
      run: python -m build .
    - name: Publish
      uses: pypa/gh-action-pypi-publish@release/v1
      with:
        password: ${{ secrets.pypi_password }}
