11# Step 6 (v2): Builds and publishes the v2 package to PyPI from a release/v{version} branch.
2- # Converts semver pre-release version to PEP 440 format before building.
2+ # Reads version from .release-please-manifest-v2.json, converts to PEP 440,
3+ # updates version.py, then builds and publishes.
34# Creates a merge-back PR (step 7) to sync release changes to v2.
45name : " Release v2: Publish to PyPi"
56
@@ -17,15 +18,16 @@ jobs:
1718 - name : Validate branch
1819 run : |
1920 if [[ ! "${GITHUB_REF_NAME}" =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
20- echo "Error: Must run from a release/v* branch (e.g., release/v2.0.0-alpha.1 )"
21+ echo "Error: Must run from a release/v* branch (e.g., release/v2.0.0-alpha.2 )"
2122 exit 1
2223 fi
2324
24- - name : Extract and convert version to PEP 440
25+ - uses : actions/checkout@v6
26+
27+ - name : Extract version from manifest and convert to PEP 440
2528 id : version
2629 run : |
27- VERSION="${GITHUB_REF_NAME}"
28- VERSION="${VERSION#release/v}"
30+ VERSION=$(jq -r '.["."]' .github/.release-please-manifest-v2.json)
2931 echo "semver=$VERSION" >> $GITHUB_OUTPUT
3032 echo "Semver version: $VERSION"
3133
3840 echo "pep440=$PEP440" >> $GITHUB_OUTPUT
3941 echo "PEP 440 version: $PEP440"
4042
41- - uses : actions/checkout@v6
42-
4343 - name : Install uv
4444 uses : astral-sh/setup-uv@v4
4545 with :
@@ -50,13 +50,13 @@ jobs:
5050 with :
5151 python-version : " 3.11"
5252
53- - name : Update pyproject.toml with PEP 440 version
53+ - name : Update version.py with PEP 440 version
5454 env :
5555 PEP440_VERSION : ${{ steps.version.outputs.pep440 }}
5656 run : |
57- # Update version in pyproject.toml if it differs from PEP 440
58- sed -i "s/^version = .*/ version = \" ${PEP440_VERSION}\"/" pyproject.toml
59- echo "Updated pyproject.toml version to ${PEP440_VERSION}"
57+ sed -i "s/^__version__ = .*/__version__ = \"${PEP440_VERSION}\"/" src/google/adk/version.py
58+ echo "Updated version.py to ${PEP440_VERSION}"
59+ grep __version__ src/google/adk/ version.py
6060
6161 - name : Build package
6262 run : uv build
0 commit comments