chore: import upstream snapshot with attribution
Continuous Integration / Pre-commit Linter (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.10) (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.11) (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.12) (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.13) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.10) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.11) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.12) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.13) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.14) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.10) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.11) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.12) (push) Has been cancelled
Copybara PR Handler / close-imported-pr (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.13) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.14) (push) Has been cancelled
Continuous Integration / Pre-commit Linter (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.10) (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.11) (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.12) (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.13) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.10) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.11) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.12) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.13) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.14) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.10) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.11) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.12) (push) Has been cancelled
Copybara PR Handler / close-imported-pr (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.13) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.14) (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
# 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.
|
||||
|
||||
# Builds and publishes the package to PyPI from a release/v* branch.
|
||||
# Supports both main (v2+) stable releases and v1 pre-releases (with auto PEP 440 version mapping).
|
||||
# Creates a merge-back PR to sync changes back to the base branch (main or v1).
|
||||
name: "Release: Publish to PyPi"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
if: github.repository == 'google/adk-python'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Validate branch
|
||||
run: |
|
||||
if [[ ! "${GITHUB_REF_NAME}" =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
||||
echo "Error: Must run from a release/v* branch (e.g., release/v0.3.0 or release/v1.35.0-alpha.1)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Determine Release Type and Extract Version
|
||||
id: version
|
||||
run: |
|
||||
BRANCH_NAME="${GITHUB_REF_NAME}"
|
||||
VERSION="${BRANCH_NAME#release/v}"
|
||||
|
||||
# Check if this version matches the one in the v1 manifest to determine if it's a v1 release
|
||||
if [ -f .github/.release-please-manifest-v1.json ] && jq -e --arg v "$VERSION" '.["."] == $v' .github/.release-please-manifest-v1.json &>/dev/null; then
|
||||
echo "is_v1=true" >> $GITHUB_OUTPUT
|
||||
echo "base_branch=v1" >> $GITHUB_OUTPUT
|
||||
|
||||
SEMVER="$VERSION"
|
||||
echo "semver=$SEMVER" >> $GITHUB_OUTPUT
|
||||
echo "Semver version (v1): $SEMVER"
|
||||
|
||||
# PEP 440 Conversion (e.g., 2.0.0-alpha.1 -> 2.0.0a1)
|
||||
PEP440=$(echo "$SEMVER" | sed -E 's/-alpha\./a/; s/-beta\./b/; s/-rc\./rc/')
|
||||
echo "pep440=$PEP440" >> $GITHUB_OUTPUT
|
||||
echo "PEP 440 version (v1): $PEP440"
|
||||
else
|
||||
echo "is_v1=false" >> $GITHUB_OUTPUT
|
||||
echo "base_branch=main" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "semver=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "pep440=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "Semver version (main): $VERSION"
|
||||
fi
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
version: "latest"
|
||||
enable-cache: true
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Update version.py with PEP 440 version (v1 only)
|
||||
if: steps.version.outputs.is_v1 == 'true'
|
||||
env:
|
||||
PEP440_VERSION: ${{ steps.version.outputs.pep440 }}
|
||||
run: |
|
||||
sed -i "s/^__version__ = .*/__version__ = \"${PEP440_VERSION}\"/" src/google/adk/version.py
|
||||
echo "Updated version.py to ${PEP440_VERSION}"
|
||||
grep __version__ src/google/adk/version.py
|
||||
|
||||
- name: Build package
|
||||
run: uv build
|
||||
|
||||
- name: Publish to PyPI
|
||||
env:
|
||||
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
||||
run: uv publish
|
||||
|
||||
- name: Create merge-back PR
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.RELEASE_PAT }}
|
||||
SEMVER_VERSION: ${{ steps.version.outputs.semver }}
|
||||
PEP440_VERSION: ${{ steps.version.outputs.pep440 }}
|
||||
BASE_BRANCH: ${{ steps.version.outputs.base_branch }}
|
||||
run: |
|
||||
gh pr create \
|
||||
--base "$BASE_BRANCH" \
|
||||
--head "${GITHUB_REF_NAME}" \
|
||||
--title "chore: merge release v${PEP440_VERSION} to $BASE_BRANCH" \
|
||||
--body "Syncs version bump and CHANGELOG from release v${SEMVER_VERSION} to $BASE_BRANCH."
|
||||
Reference in New Issue
Block a user