-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Consolidate release automation script for a2ui-core and a2ui-agent-sdk #1634
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,15 @@ | ||
| # 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, | ||
| # 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. | ||
|
|
||
| from a2ui.core.version import __version__ as __version__ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # 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, | ||
| # 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. | ||
|
|
||
| # File-based dynamic versioning | ||
| # - The next release version | ||
| # - Version format: major.minor.patch | ||
| # - Update the version in this file before releasing | ||
| # | ||
| __version__ = "0.0.3" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,11 +13,35 @@ | |||||||||
| # See the License for the specific language governing permissions and | ||||||||||
| # limitations under the License. | ||||||||||
|
|
||||||||||
|
|
||||||||||
| set -e # Exit on error | ||||||||||
| #set -x # Echo commands | ||||||||||
|
|
||||||||||
| PACKAGE_NAME="a2ui-agent-sdk" | ||||||||||
| # Check arguments | ||||||||||
| if [ -z "$1" ]; then | ||||||||||
| echo "Usage: $0 <a2ui_agent|a2ui_core>" | ||||||||||
| exit 1 | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| SCRIPT_DIR=$(dirname "$(readlink -f "$0")") | ||||||||||
| TARGET_DIR="${SCRIPT_DIR}/${1}" | ||||||||||
|
|
||||||||||
| if [ ! -d "$TARGET_DIR" ]; then | ||||||||||
| echo "Error: Directory '$TARGET_DIR' does not exist." | ||||||||||
| exit 1 | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| cd "$TARGET_DIR" | ||||||||||
|
|
||||||||||
| # Read package name from pyproject.toml | ||||||||||
| if [ ! -f "pyproject.toml" ]; then | ||||||||||
| echo "Error: pyproject.toml not found in '$TARGET_DIR'." | ||||||||||
| exit 1 | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| PACKAGE_NAME=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['name'])") | ||||||||||
|
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.
We can make this robust by using
Suggested change
|
||||||||||
| VERSION=$(uv run --with hatch hatch version) | ||||||||||
|
|
||||||||||
| echo "Releasing package: $PACKAGE_NAME ($VERSION) from folder: $TARGET_DIR" | ||||||||||
|
|
||||||||||
| REPOSITORY="a2ui--pypi" | ||||||||||
| PROJECT="oss-exit-gate-prod" | ||||||||||
| LOCATION="us" | ||||||||||
|
|
@@ -36,29 +60,27 @@ echo "--- Uploading the package ---" | |||||||||
| twine --version | ||||||||||
| twine check dist/* | ||||||||||
|
Comment on lines
60
to
61
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. Run
Suggested change
|
||||||||||
|
|
||||||||||
| version=$(uv run python -c "import a2ui; print(a2ui.__version__)") | ||||||||||
|
|
||||||||||
| # Authenticate with Google Cloud | ||||||||||
| if ! gcloud auth application-default print-access-token --quiet > /dev/null; then | ||||||||||
| gcloud auth application-default login | ||||||||||
| 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'." | ||||||||||
| if gcloud artifacts versions describe "$VERSION" --package="$PACKAGE_NAME" --repository="$REPOSITORY" --location="$LOCATION" --project="$PROJECT" > /dev/null 2>&1; then | ||||||||||
| echo "Version $VERSION of $PACKAGE_NAME already exists in Artifact Registry. Skip the release." | ||||||||||
| echo "Hint: If you intended to release a new version, please update its version in pyproject.toml or version.py." | ||||||||||
| exit 0 | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| twine upload --repository-url $REPOSITORY_URL dist/* | ||||||||||
| echo "Version $version uploaded to Artifact Registry." | ||||||||||
| twine upload --repository-url "$REPOSITORY_URL" dist/* | ||||||||||
|
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. Run
Suggested change
|
||||||||||
| echo "Version $VERSION of $PACKAGE_NAME uploaded to Artifact Registry." | ||||||||||
|
|
||||||||||
| echo "--- Creating manifest.json ---" | ||||||||||
| MANIFEST_FILE="manifest.json" | ||||||||||
| echo '{ "publish_all": true }' > $MANIFEST_FILE | ||||||||||
|
|
||||||||||
| echo "--- Uploading manifest to GCS to trigger OSS Exit Gate ---" | ||||||||||
| MANIFEST_NAME="manifest-${version}-$(date +%Y%m%d%H%M%S).json" | ||||||||||
| MANIFEST_NAME="manifest-${VERSION}-$(date +%Y%m%d%H%M%S).json" | ||||||||||
| gcloud storage cp $MANIFEST_FILE "${GCS_URI}/${MANIFEST_NAME}" | ||||||||||
| rm -rf $MANIFEST_FILE | ||||||||||
|
|
||||||||||
|
|
||||||||||
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.
Using
readlink -fis not portable because the-foption is not supported by the defaultreadlinkimplementation on macOS. This will cause the script to fail when run on macOS.A more portable way to get the script's directory in Bash is to use
cdandpwd -P.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.
This seems like a good idea - would be great for this to work on macos