diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8b8fdbe..4fb22f4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -138,6 +138,7 @@ jobs: name: pypi url: https://pypi.org/p/tpu-info permissions: + contents: read id-token: write steps: @@ -147,5 +148,29 @@ jobs: name: tpu-info-dist path: dist/ - - name: Publish distribution to PyPI - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 + - name: Authenticate to Google Cloud + uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0 + with: + workload_identity_provider: 'projects/305452601764/locations/global/workloadIdentityPools/builders/providers/github' + - name: Set up Cloud SDK + uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3 + - name: Stage distributions and trigger OSS Exit Gate release + env: + RUN_ID: ${{ github.run_id }} + RUN_ATTEMPT: ${{ github.run_attempt }} + run: | + set -euo pipefail + python3 -m venv .exit-gate-venv + .exit-gate-venv/bin/python -m pip install --upgrade pip twine keyrings.google-artifactregistry-auth + .exit-gate-venv/bin/python -m twine upload \ + --repository-url https://us-python.pkg.dev/oss-exit-gate-prod/tpu-info--pypi/ \ + --non-interactive \ + --skip-existing \ + dist/* + cat < manifest.json + { + "publish_all": true + } + EOF + gcloud storage cp manifest.json \ + "gs://oss-exit-gate-prod-projects-bucket/tpu-info/pypi/manifests/manifest-${RUN_ID}-${RUN_ATTEMPT}.json"