name: parse_this publish package to pypi

on:
  push:
    branches:
      - master
    paths:
      - setup.py

jobs:
  publish:

    runs-on: ubuntu-latest

    steps:
        - uses: actions/checkout@v2
        - name: set up Python
          uses: actions/setup-python@v2
          with:
            python-version: "3.x"
        - name: install dependencies
          run: |
            python -m pip install --upgrade pip
            pip install build
        - name: build package
          run: python -m build
        - name: publish package
          uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
          with:
            user: __token__
            password: ${{ secrets.PYPI_API_TOKEN }}

name: parse_this publish package to pypi

on:
  push:
    branches:
      - master
    paths:
      - setup.py

jobs:
  publish:

    runs-on: ubuntu-latest

    steps:
        - uses: actions/checkout@v2
        - name: set up Python
          uses: actions/setup-python@v2
          with:
            python-version: "3.x"
        - name: install dependencies
          run: |
            python -m pip install --upgrade pip
            pip install build
        - name: build package
          run: python -m build
        - name: tag master
        - run: |
            : # extract version from setup.py
            VERSION=$(awk -F '=' '/version=[0-9.]*/ { print substr($2, 2, length($2) - 3) }' setup.py)
            : # tag the commit on top of which the PR is merged
            git tag v${VERSION} ${{ github.event.pull_request.base.ref }}
            git push origin v${VERSION}
        - name: publish package
          uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
          with:
            user: __token__
            password: ${{ secrets.PYPI_API_TOKEN }}

Add step to tag master when a PR is merged
Add step to tag master when a PR is merged

Extract version from setup.py and use it to tag master.

Tests:
- none
