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: 43 additions & 10 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v6
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.11'

Expand All @@ -35,11 +35,44 @@ jobs:
grep "__version__" torchax/__init__.py

- name: Build Wheel and Sdist
run: python -m build --wheel

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# Note: We are NOT providing a password here because we will use Trusted Publishing.
# If you must use a token, uncomment the lines below:
# with:
# password: ${{ secrets.PYPI_API_TOKEN }}
run: |
pip install twine
python -m build --wheel

- name: Authenticate to Google Cloud (OSS Exit Gate)
uses: google-github-actions/auth@c200f3691d83b41bf9bbd8638997a462592937ed
with:
workload_identity_provider: 'projects/305452601764/locations/global/workloadIdentityPools/builders/providers/github'

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@e427ad8a34f8676edf47cf7d7925499adf3eb74f

- name: Clean up stale releases from staging repo
run: |
# clean up stale releases from staging repo
packages=$(gcloud artifacts packages list \
--project="oss-exit-gate-prod" \
--location="us" \
--repository="torchax--pypi" \
--format="value(name)" 2>/dev/null)

echo "${packages}" | xargs -r -I {} sh -c '
package_name=$(basename "{}")
echo "Deleting package: $package_name..."
gcloud artifacts packages delete "{}" \
--project="oss-exit-gate-prod" \
--location="us" \
--repository="torchax--pypi" \
--quiet
'

- name: Stage to OSS Exit Gate and upload manifest
run: |
python -m twine upload \
--repository-url "https://us-python.pkg.dev/oss-exit-gate-prod/torchax--pypi/" \
-u oauth2accesstoken \
-p "$(gcloud auth print-access-token)" \
dist/*
echo '{"publish_all": true}' > manifest.json
gcloud storage cp manifest.json \
"gs://oss-exit-gate-prod-projects-bucket/torchax/pypi/manifests/manifest-${{ github.run_id }}-${{ github.run_attempt }}.json"
Loading