name: Release to PyPI
on:
  release:
    types: [published]

jobs:
  release:
    name: Release to PyPI
    strategy:
      fail-fast: false
      matrix:
        python-version: [3.6]
        poetry-version: [1.1.4]
        os: [ubuntu-latest]
    runs-on: ubuntu-latest

    steps:
      - name: Git Checkout
        uses: actions/checkout@v2

      - name: Install Python
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install Poetry
        uses: abatilo/actions-poetry@v2.0.0
        with:
          poetry-version: ${{ matrix.poetry-version }}

      - name: Build hyperglass
        run: |
          poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
          poetry build

      - name: Publish hyperglass release
        run: poetry publish
