name: Upload Python Package on: push: branches: - main permissions: contents: read jobs: check: runs-on: ubuntu-latest outputs: changed: ${{ steps.changed-files-specific.outputs.any_changed }} steps: - uses: actions/checkout@v3 with: fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. - name: Get changed files in the docs folder id: changed-files-specific uses: tj-actions/changed-files@v35 with: files: fishy/version.txt # Alternatively using: `docs/**` or `docs` deploy: runs-on: ubuntu-latest needs: check if: ${{ needs.check.outputs.changed == 'true' }} steps: - uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v3 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 }}