diff --git a/.github/workflows/protobuf.yml b/.github/workflows/protobuf.yml index 40923dd62..0a6401455 100644 --- a/.github/workflows/protobuf.yml +++ b/.github/workflows/protobuf.yml @@ -131,7 +131,7 @@ jobs: if-no-files-found: error - name: Upload Python Distribution - if: ${{ github.event_name == 'pull_request' }} + if: ${{ github.event_name == 'pull_request' || ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) }} uses: actions/upload-artifact@v4 with: name: python-dist @@ -224,3 +224,27 @@ jobs: - name: Run Python Tests run: python -m unittest discover tests + + publish-python-dist: + name: Publish Python Distribution + + runs-on: ubuntu-22.04 + + permissions: + id-token: write + + needs: [build-proto2-linux64, build-proto3-linux64] + + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + + steps: + - name: Download Distribution + uses: actions/download-artifact@v4 + with: + name: python-dist + path: dist/ + + - name: Publish Snapshot Release on TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/