name: Create Release

on:
  push:
    tags:
      - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10


jobs:
  deploy:
    runs-on: ubuntu-latest
    if: github.repository == 'napari/napari-plugin-engine'
    steps:
      - name: Checkout code
        uses: actions/checkout@master
      - name: Install Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.8
      - name: Install Dependencies
        run: |
          python -m pip install --upgrade pip
          python -m pip install pep517
      - name: Build Distribution
        run: |
          python -m pep517.build .
      - name: Publish PyPI Package
        uses: pypa/gh-action-pypi-publish@master
        with:
          user: __token__
          password: ${{ secrets.pypi_password }}
