Rebuild Main Search Index (Manual) #34
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: Build Search Index | |
| on: | |
| # Run after registry update | |
| workflow_run: | |
| workflows: ["Update Registry"] | |
| types: [completed] | |
| # Manual trigger | |
| workflow_dispatch: | |
| # Run on push to main (for index script changes) | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'scripts/build_search_index.py' | |
| - 'docs/**' | |
| - '.github/workflows/build-index.yml' | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build-index: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: pip install pyyaml | |
| - name: Build search index | |
| run: | | |
| echo "Building search index from registry.json (deduplicated)..." | |
| python scripts/build_search_index.py --use-registry --registry registry.json --output docs | |
| echo "" | |
| echo "Index files generated:" | |
| ls -la docs/ | |
| ls -la docs/categories/ || true | |
| echo "" | |
| echo "Index sizes:" | |
| du -sh docs/*.json docs/*.gz 2>/dev/null || true | |
| - name: Commit index files | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add docs/ | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "chore: rebuild search index" | |
| git push | |
| fi | |
| deploy-pages: | |
| needs: build-index | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main # Get latest changes including index | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: 'docs' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |