Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 47 additions & 6 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ permissions:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- name: Validate branch
run: |
Expand All @@ -28,25 +32,62 @@ jobs:
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Publishing version: $VERSION"

- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: Install uv
uses: astral-sh/setup-uv@v4
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
with:
version: "latest"

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.11"

- name: Build package
run: uv build

- name: Publish to PyPI
- 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: Clean up prior staged artifacts in OSS Exit Gate repository
run: |
set -euo pipefail
EXISTING_PKGS="$(gcloud artifacts packages list \
--project=oss-exit-gate-prod \
--location=us \
--repository=adk-python-community--pypi \
--format='value(name)' 2>/dev/null || true)"
for pkg in ${EXISTING_PKGS}; do
gcloud artifacts packages delete "${pkg}" \
--project=oss-exit-gate-prod \
--location=us \
--repository=adk-python-community--pypi \
--quiet || true
done

- name: Publish to OSS Exit Gate
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: uv publish
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
run: |
set -euo pipefail
set +x
TOKEN="$(gcloud auth print-access-token)"
uv publish \
--publish-url https://us-python.pkg.dev/oss-exit-gate-prod/adk-python-community--pypi/ \
--username oauth2accesstoken \
--password "${TOKEN}" \
dist/*
unset TOKEN
printf '{"publish_all": true}\n' > manifest.json
gcloud storage cp manifest.json \
"gs://oss-exit-gate-prod-projects-bucket/adk-python-community/pypi/manifests/manifest-${RUN_ID}-${RUN_ATTEMPT}.json"

- name: Create merge-back PR
env:
Expand Down
Loading