name: Publish

on:
  # Dependency to a testing workflow
  workflow_run:
    workflows: ["Testing"]
    branches: [ master ]
    types:
      - completed

jobs:
  publish:
    # Prevent Publish from running on forks.
    if: |
      github.repository == 'tensorflow/similarity' &&
      ${{ github.event.workflow_run.conclusion == 'success' }}

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.9'
    
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        
    - name: Install package
      run: |
        pip install ".[dev]"
      
    - name: Build package
      run: |
        python setup.py sdist bdist_wheel

    - name: Publish package
      run: |
        twine upload -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPY_TOKEN }} dist/* --verbose

name: Publish

on:
  workflow_dispatch:  # Allow manual triggers

jobs:
  publish:
    # Prevent Publish from running on forks.
    if: |
      github.ref == 'refs/heads/master' &&
      github.repository == 'tensorflow/similarity'

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.9'
    
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        
    - name: Install package
      run: |
        pip install ".[dev]"
      
    - name: Build package
      run: |
        python setup.py sdist bdist_wheel

    - name: Publish package
      run: |
        twine upload -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPY_TOKEN }} dist/* --verbose

Make master publish a manual event.
Make master publish a manual event.
