name: publish-to-pypi
on: [ push, pull_request ]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Setup Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.7
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install wheel
          pip install -e ".[aws,test]"
          echo $(git describe --abbrev=0 --tags) > drift/VERSION
      - name: Run PyTest
        run: pytest .

  publish:
    if: startsWith(github.ref, 'refs/tags/')
    runs-on: ubuntu-latest
    needs: test
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Setup Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.7
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install setuptools wheel twine
          pip install -e ".[aws,test]"
      - name: Stamp version
        run: |
          echo $(git describe --abbrev=0 --tags) > drift/VERSION
      - name: Publish to PyPi
        env:
          TWINE_USERNAME: __token__
          TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
        run: |
          python setup.py sdist bdist_wheel
          twine check dist/*
          twine upload --repository-url https://test.pypi.org/legacy/ dist/*

name: publish-to-pypi
on: [ push, pull_request ]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Setup Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.7
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install wheel
          pip install -e ".[aws,test]"
          echo $(git describe --abbrev=0 --tags) > drift/VERSION
      - name: Run PyTest
        run: pytest .

  publish:
    runs-on: ubuntu-latest
    needs: test
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Setup Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.7
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install setuptools wheel twine
          pip install -e ".[aws,test]"
      - name: Stamp version
        run: |
          echo $(git describe --abbrev=0 --tags) > drift/VERSION
      - name: Publish to PyPi
        env:
          TWINE_USERNAME: __token__
          TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
        run: |
          python setup.py sdist bdist_wheel
          twine check dist/*
          twine upload --repository-url https://test.pypi.org/legacy/ dist/*

Remove false condition on publish step
Remove false condition on publish step
