|
| 1 | +name: Release: Update ADk Web |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + adk_web_repo: |
| 7 | + description: 'Source adk-web repository' |
| 8 | + required: true |
| 9 | + default: 'google/adk-web' # Default source repo |
| 10 | + adk_web_tag: |
| 11 | + description: 'Tag of the release to download (e.g. v1.0.0).' |
| 12 | + required: false |
| 13 | + default: '' |
| 14 | + |
| 15 | +jobs: |
| 16 | + update-frontend: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: write |
| 20 | + pull-requests: write |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout repository |
| 24 | + uses: actions/checkout@v5 |
| 25 | + |
| 26 | + - name: Fetch and unzip frontend assets |
| 27 | + run: | |
| 28 | + TARGET_DIR="src/google/adk/cli/browser" |
| 29 | + REPO="${{ github.event.inputs.adk_web_repo }}" |
| 30 | + TAG="${{ github.event.inputs.adk_web_tag }}" |
| 31 | + # Clean target directory |
| 32 | + rm -rf "$TARGET_DIR"/* |
| 33 | + mkdir -p "$TARGET_DIR" |
| 34 | + if [ -z "$TAG" ]; then |
| 35 | + echo "Fetching latest release metadata for $REPO..." |
| 36 | + RELEASE_JSON=$(curl -s "https://api.github.com/repos/$REPO/releases/latest") |
| 37 | + else |
| 38 | + echo "Fetching release metadata for $REPO tag $TAG..." |
| 39 | + RELEASE_JSON=$(curl -s "https://api.github.com/repos/$REPO/releases/tags/$TAG") |
| 40 | + fi |
| 41 | + # Extract download URL for adk-web-browser.zip |
| 42 | + DOWNLOAD_URL=$(echo "$RELEASE_JSON" | grep -o -E '"browser_download_url": "[^"]+"' | grep -o -E 'https://[^"]+' | grep 'adk-web-browser.zip' | head -n 1) |
| 43 | + if [ -z "$DOWNLOAD_URL" ]; then |
| 44 | + echo "Error: Could not find adk-web-browser.zip asset in the release." |
| 45 | + exit 1 |
| 46 | + fi |
| 47 | + echo "Downloading assets from: $DOWNLOAD_URL" |
| 48 | + curl -L -o frontend.zip "$DOWNLOAD_URL" |
| 49 | + echo "Extracting assets to $TARGET_DIR..." |
| 50 | + unzip -o frontend.zip -d "$TARGET_DIR" |
| 51 | + rm frontend.zip |
| 52 | + echo "Assets extracted successfully." |
| 53 | +
|
| 54 | + - name: Create Pull Request |
| 55 | + uses: peter-evans/create-pull-request@v6 |
| 56 | + with: |
| 57 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + commit-message: "Update compiled adk web files from ${{ github.event.inputs.adk_web_repo }}@${{ github.event.inputs.adk_web_tag || 'latest' }}" |
| 59 | + branch: update-frontend-assets |
| 60 | + delete-branch: true |
| 61 | + title: "chore: update compiled adk web assets" |
| 62 | + body: | |
| 63 | + This PR automatically updates the compiled adk web files in `src/google/adk/cli/browser/` using the assets from `${{ github.event.inputs.adk_web_repo }}@${{ github.event.inputs.adk_web_tag || 'latest' }}`. |
| 64 | + Please review the diff before merging. |
0 commit comments