name: Build release version

on:
  push:
    tags:
      - 'v*'
  pull_request:
    branches:
      master

jobs:
  deploy:
    runs-on: ubuntu-20.04
    steps:
      - name: Set up python 3.6
        uses: actions/setup-python@v2
        with:
          python-version: 3.6

      - name: Checkout
        uses: actions/checkout@v2

      - name: Install requirements
        run: |
          pip install pip==21.3.1 setuptools==47.1.0 wheel==0.37.0
          pip install -r requirements/base.txt -r requirements/dev.txt

      - name: Versioning
        if: ${{ startsWith(github.ref, 'refs/tags/') }}
        shell: bash
        run: |
          GITHUB_TAG="${GITHUB_REF##refs/tags/v}"
          [[ $GITHUB_TAG =~ ^[0-9]+.[0-9]+.[0-9]+$ ]] && \
          echo "__version__ = \"${GITHUB_TAG}\"" > pymanopt/_version.py

      - name: Build sdist and wheel
        run: python setup.py sdist bdist_wheel

      - name: Publish to pypi on tags
        if: ${{ startsWith(github.ref, 'refs/tags/') }}
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          user: __token__
          password: ${{ secrets.PYPI_API_TOKEN }}

name: Build release version

on:
  push:
    tags:
      - 'v*'
  pull_request:
    branches:
      master

jobs:
  deploy:
    runs-on: ubuntu-20.04
    steps:
      - name: Set up python 3.6
        uses: actions/setup-python@v2
        with:
          python-version: 3.6

      - name: Checkout
        uses: actions/checkout@v2

      - name: Install requirements
        run: |
          pip install pip==21.3.1 setuptools==47.1.0 wheel==0.37.0
          pip install -r requirements/base.txt -r requirements/dev.txt

      - name: Versioning
        if: ${{ startsWith(github.ref, 'refs/tags/') }}
        shell: bash
        run: |
          GITHUB_TAG="${GITHUB_REF##refs/tags/v}"
          [[ $GITHUB_TAG =~ ^[0-9]+.[0-9]+.[0-9]+ ]] && \
            echo "__version__ = \"${GITHUB_TAG}\"" > pymanopt/_version.py

      - name: Build sdist and wheel
        run: python setup.py sdist bdist_wheel

      - name: Publish to pypi on tags
        if: ${{ startsWith(github.ref, 'refs/tags/') }}
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          user: __token__
          password: ${{ secrets.PYPI_API_TOKEN }}

Add suport for release candidate tags
Add suport for release candidate tags

Signed-off-by: Niklas Koep <342d5290239d9c5264c8f98185afedb99596601a@gmail.com>
