feat: streamline tool calls and subagent activity in Desktop (#236) #257
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Docs to GitHub Pages | |
| on: | |
| push: | |
| branches: [ master, main ] | |
| paths: | |
| - 'docs/**' | |
| # The desktop web demo (docs/demo) imports Desktop renderer sources; | |
| # rebuild the site when they change so reuse drift fails the deploy. | |
| - 'desktop/src/**' | |
| - '.github/workflows/pages.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: npm | |
| cache-dependency-path: | | |
| docs/package-lock.json | |
| docs/demo/package-lock.json | |
| - name: Setup Pages | |
| id: pages | |
| uses: actions/configure-pages@v6 | |
| - name: Install desktop demo dependencies | |
| run: npm ci | |
| working-directory: docs/demo | |
| - name: Build desktop demo | |
| run: npm run build | |
| working-directory: docs/demo | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: docs | |
| - name: Build site | |
| run: npm run build | |
| working-directory: docs | |
| env: | |
| VITEPRESS_BASE: ${{ steps.pages.outputs.base_path }}/ | |
| - name: Write build metadata | |
| shell: bash | |
| run: | | |
| node <<'EOF' | |
| const fs = require('node:fs') | |
| const metadata = { | |
| sha: process.env.GITHUB_SHA, | |
| runId: process.env.GITHUB_RUN_ID, | |
| runAttempt: process.env.GITHUB_RUN_ATTEMPT, | |
| repository: process.env.GITHUB_REPOSITORY, | |
| ref: process.env.GITHUB_REF, | |
| basePath: process.env.VITEPRESS_BASE, | |
| builtAt: new Date().toISOString() | |
| } | |
| fs.writeFileSync('docs/.vitepress/dist/build-info.json', `${JSON.stringify(metadata, null, 2)}\n`) | |
| EOF | |
| env: | |
| VITEPRESS_BASE: ${{ steps.pages.outputs.base_path }}/ | |
| - name: Validate Pages artifact | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| test -s docs/.vitepress/dist/index.html | |
| test -d docs/.vitepress/dist/assets | |
| test -s docs/.vitepress/dist/build-info.json | |
| file_count=$(find docs/.vitepress/dist -type f | wc -l) | |
| if [ "$file_count" -lt 10 ]; then | |
| echo "::error::Pages artifact looks incomplete: only $file_count files" | |
| exit 1 | |
| fi | |
| echo "Pages artifact contains $file_count files" | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: docs/.vitepress/dist | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 | |
| - name: Verify published build | |
| timeout-minutes: 5 | |
| shell: bash | |
| env: | |
| PAGE_URL: ${{ steps.deployment.outputs.page_url }} | |
| EXPECTED_SHA: ${{ github.sha }} | |
| run: | | |
| set -euo pipefail | |
| if [ -z "${PAGE_URL:-}" ]; then | |
| echo "::error::deploy-pages did not return a page_url output" | |
| exit 1 | |
| fi | |
| info_url="${PAGE_URL%/}/build-info.json" | |
| for attempt in {1..18}; do | |
| rm -f build-info.remote.json | |
| if curl -fsSL "$info_url" -o build-info.remote.json; then | |
| actual_sha=$(node -e "const fs = require('node:fs'); const data = JSON.parse(fs.readFileSync('build-info.remote.json', 'utf8')); console.log(data.sha || '')" 2>/dev/null || true) | |
| if [ "$actual_sha" = "$EXPECTED_SHA" ]; then | |
| echo "Published build matches $EXPECTED_SHA" | |
| exit 0 | |
| fi | |
| echo "Published SHA is '${actual_sha:-<missing>}' at $info_url; waiting for $EXPECTED_SHA (attempt $attempt/18)" | |
| else | |
| echo "Could not fetch $info_url yet (attempt $attempt/18)" | |
| fi | |
| sleep 10 | |
| done | |
| echo "::error::Pages did not serve build-info.json for $EXPECTED_SHA at $info_url" | |
| exit 1 |