-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add release script for a2ui python agent #1056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,64 @@ | ||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||
| # Copyright 2026 Google LLC | ||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||
| # you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||
| # You may obtain a copy of the License at | ||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||
| # Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||
|
Comment on lines
+6
to
+11
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The project, repository, and GCS bucket names are hardcoded to production values. To make the script more flexible and testable (e.g., for dry runs or staging releases), consider allowing these to be overridden via environment variables with the current values as defaults.
Suggested change
|
||||||||||||||||||||||||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||
| # See the License for the specific language governing permissions and | ||||||||||||||||||||||||||
| # limitations under the License. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
Comment on lines
+14
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| set -e # Exit on error | ||||||||||||||||||||||||||
| #set -x # Echo commands | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| PACKAGE_NAME="a2ui-agent-sdk" | ||||||||||||||||||||||||||
| REPOSITORY="a2ui--pypi" | ||||||||||||||||||||||||||
| PROJECT="oss-exit-gate-prod" | ||||||||||||||||||||||||||
| LOCATION="us" | ||||||||||||||||||||||||||
| REPOSITORY_URL="https://us-python.pkg.dev/${PROJECT}/${REPOSITORY}" | ||||||||||||||||||||||||||
| GCS_URI="gs://oss-exit-gate-prod-projects-bucket/a2ui/pypi/manifests" | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Importing the package to extract the version number can be fragile if the environment is not fully set up or if the package has side effects on import. Since the version is defined in a simple Python file, consider parsing it directly to avoid unnecessary execution.
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "--- Installing helper packages ---" | ||||||||||||||||||||||||||
| uv tool install twine --with keyrings.google-artifactregistry-auth --with keyring | ||||||||||||||||||||||||||
| uv tool install keyring --with keyrings.google-artifactregistry-auth | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The command
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "--- Building the package ---" | ||||||||||||||||||||||||||
| rm -rf dist | ||||||||||||||||||||||||||
| uv build | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "--- Uploading the package ---" | ||||||||||||||||||||||||||
| twine --version | ||||||||||||||||||||||||||
| twine check dist/* | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| version=$(uv run python -c "import a2ui; print(a2ui.__version__)") | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is recommended to use the
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Authenticate with Google Cloud | ||||||||||||||||||||||||||
| if ! gcloud auth application-default print-access-token --quiet > /dev/null; then | ||||||||||||||||||||||||||
| gcloud auth application-default login | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Check if the version already exists in the staging repository | ||||||||||||||||||||||||||
| if gcloud artifacts versions describe "$version" --package=$PACKAGE_NAME --repository=$REPOSITORY --location=$LOCATION --project=$PROJECT > /dev/null 2>&1; then | ||||||||||||||||||||||||||
| echo "Version $version already exists in Artifact Registry. Skip the release." | ||||||||||||||||||||||||||
| echo "Hint: If you intended to release a new version, please update 'src/a2ui/version.py'." | ||||||||||||||||||||||||||
| exit 0 | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| twine upload --repository-url $REPOSITORY_URL dist/* | ||||||||||||||||||||||||||
| echo "Version $version uploaded to Artifact Registry." | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "--- Creating manifest.json ---" | ||||||||||||||||||||||||||
| echo '{ "publish_all": true }' > manifest.json | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "--- Uploading manifest to GCS to trigger OSS Exit Gate ---" | ||||||||||||||||||||||||||
| MANIFEST_NAME="manifest-${version}-$(date +%Y%m%d%H%M%S).json" | ||||||||||||||||||||||||||
| gcloud storage cp manifest.json "${GCS_URI}/${MANIFEST_NAME}" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "Manifest ${MANIFEST_NAME} uploaded." | ||||||||||||||||||||||||||
| echo "--- Build script finished ---" | ||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to add this internal link to the OSS project? @jacobsimionato @gspencergoog