diff --git a/.github/workflows/deploy-orama-search.yml b/.github/workflows/deploy-orama-search.yml new file mode 100644 index 000000000..2c1f19732 --- /dev/null +++ b/.github/workflows/deploy-orama-search.yml @@ -0,0 +1,91 @@ +name: Deploy Orama Search Index + +on: + push: + branches: [main] + paths: + # Only trigger when documentation content changes + - "runtime/**/*.md" + - "deploy/**/*.md" + - "examples/**/*.md" + - "subhosting/**/*.md" + - "lint/**/*.md" + - "reference_gen/**" + # Or when the build configuration changes + - "deno.json" + - "orama/**" + + # Allow manual triggering for testing + workflow_dispatch: + inputs: + force_deploy: + description: "Force deploy even without content changes" + required: false + default: false + type: boolean + +jobs: + deploy-search-index: + name: Generate and Deploy Search Index + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + # Fetch more history for content change detection + fetch-depth: 2 + + - name: Setup Deno + uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + + - name: Check for content changes + id: changes + run: | + if [ "${{ github.event.inputs.force_deploy }}" = "true" ]; then + echo "Force deploy requested" + echo "content_changed=true" >> $GITHUB_OUTPUT + else + # Check if any content files changed in the last commit + CHANGED=$(git diff --name-only HEAD~1 HEAD | grep -E '\.(md|json)$|^reference_gen/|^orama/' || echo "") + if [ -n "$CHANGED" ]; then + echo "content_changed=true" >> $GITHUB_OUTPUT + echo "Content files changed:" + echo "$CHANGED" | sed 's/^/ /' + else + echo "content_changed=false" >> $GITHUB_OUTPUT + echo " No content changes detected - skipping search index update" + fi + fi + + - name: Generate comprehensive search index + if: steps.changes.outputs.content_changed == 'true' + run: | + echo "Generating comprehensive Orama search index..." + deno task generate:orama:full + + - name: Upload and deploy to Orama Cloud + if: steps.changes.outputs.content_changed == 'true' + run: | + echo "Uploading search index to Orama Cloud..." + deno task upload:orama static/orama-index-full.json --deploy + env: + ORAMA_INDEX_ID: ${{ secrets.ORAMA_INDEX_ID }} + ORAMA_PRIVATE_API_KEY: ${{ secrets.ORAMA_PRIVATE_API_KEY }} + + - name: Report deployment success + if: steps.changes.outputs.content_changed == 'true' + run: | + echo "Search index deployment completed successfully!" + echo "Updated search includes:" + echo " Documentation pages" + echo " API references (Deno, Web, Node.js)" + echo " Total searchable documents: ~5,856" + + - name: Skip deployment message + if: steps.changes.outputs.content_changed == 'false' + run: | + echo "No content changes detected - search index deployment skipped" + echo "To force a deployment, use the 'workflow_dispatch' trigger with force_deploy=true" diff --git a/.gitignore b/.gitignore index 9291d9802..e2585a616 100644 --- a/.gitignore +++ b/.gitignore @@ -14,5 +14,9 @@ reference_gen/types static/llms.txt static/llms-full.txt +# Orama search index files (generated at build time) +static/orama-index.json +static/orama-index-*.json + .DS_Store .env diff --git a/README.md b/README.md index 306650dc3..fd5e3418a 100644 --- a/README.md +++ b/README.md @@ -230,6 +230,69 @@ this command: git shortlog -s -n ``` +## Orama Search Configuration + +1. **Sign up for Orama Cloud**: Go to + [https://cloud.oramasearch.com/](https://cloud.oramasearch.com/) and create + an account. + +2. **Create a new index**: + - In the Orama dashboard, create a new index + - Set the data source to docs.deno.com or upload the documentation content + directly + +3. **Get your credentials**: + - In your Orama dashboard, you'll find your **Endpoint URL** and **Public API + Key** + - These are safe to include in frontend applications + +4. **Configure the search**: + - Open `search.client.ts` + - Replace `YOUR_ORAMA_ENDPOINT` with your actual endpoint URL + - Replace `YOUR_ORAMA_API_KEY` with your actual public API key + +### Data Sources + +For the Deno docs, we have several options: + +#### Option 1: Web Crawler (Recommended) + +- Use Orama's built-in web crawler to index your documentation site +- Go to Data Sources → Web Crawler in your Orama dashboard +- Add your site URL (e.g., `https://docs.deno.com`) +- Configure crawling rules if needed + +#### Option 2: Static Files + +- Export your documentation content as JSON +- Upload it directly to Orama +- This gives you more control over what gets indexed + +#### Option 3: API Integration + +- Use Orama's REST API to programmatically add/update content +- Useful to integrate with our build process + +### Configuration Example + +In `search.client.ts`, update the ORAMA_CONFIG object: + +```typescript +const ORAMA_CONFIG = { + endpoint: "https://cloud.orama.com/v1/indexes/your-index-id", + apiKey: "your-public-api-key-here", +}; +``` + +### Customization + +We can customize the search experience by modifying: + +- **Search modes**: Change between "fulltext", "vector", or "hybrid" search +- **Result limit**: Adjust how many results to show +- **UI styling**: Modify the CSS classes in the search components +- **Result formatting**: Change how search results are displayed + ## Deployment The `docs.deno.com` site is updated with every push to the `main` branch, which diff --git a/_components/Header.tsx b/_components/Header.tsx index 1ac7801bc..729cac8cd 100644 --- a/_components/Header.tsx +++ b/_components/Header.tsx @@ -57,7 +57,7 @@ export default function ( ))} -