name: Build and Deploy to PyPI

on: push

jobs:

  build-and-publish:
    name: Build and deploy to PyPI
    runs-on: ubuntu-latest

    steps:

    - name: Checkout code
      uses: actions/checkout@v2
      with:
        fetch-depth: 1

    - name: Set up Python 3.7
      uses: actions/setup-python@v2
      with:
        python-version: 3.7

    - name: Install Poetry
      uses: snok/install-poetry@v1.1.1

    - name: Install Dependencies
      run: poetry install

    - name: Build Package
      run: poetry build

    - name: Deploy to PyPI
      uses: pypa/gh-action-pypi-publish@master
      with:
        password: ${{ secrets.pypi_password }}
        skip_existing: true
