Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions .github/workflows/deploy-orama-search.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,35 @@ jobs:
if: steps.changes.outputs.content_changed == 'true'
run: |
echo "Uploading search index to Orama Cloud..."
if [ -z "$ORAMA_PRIVATE_API_KEY" ] || [ -z "$ORAMA_PROJECT_ID" ] || [ -z "$ORAMA_DATASOURCE_ID" ]; then
echo "⚠️ Missing Orama Cloud credentials - skipping upload"
echo "This is expected for external contributors and forks"
exit 0
fi
deno task search:upload
env:
ORAMA_PROJECT_ID: ${{ vars.ORAMA_PROJECT_ID }}
ORAMA_DATASOURCE_ID: ${{ vars.ORAMA_DATASOURCE_ID }}
ORAMA_PRIVATE_API_KEY: ${{ secrets.ORAMA_PRIVATE_API_KEY }}

- name: Report deployment success
- name: Report deployment status
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"
if [ -n "$ORAMA_PRIVATE_API_KEY" ] && [ -n "$ORAMA_PROJECT_ID" ] && [ -n "$ORAMA_DATASOURCE_ID" ]; then
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"
else
echo "⏭️ Search index upload was skipped (missing credentials)"
echo "📝 Generated search index files are available in the build artifacts"
echo "🔍 Search functionality will use the existing deployed index"
fi
env:
ORAMA_PROJECT_ID: ${{ vars.ORAMA_PROJECT_ID }}
ORAMA_DATASOURCE_ID: ${{ vars.ORAMA_DATASOURCE_ID }}
ORAMA_PRIVATE_API_KEY: ${{ secrets.ORAMA_PRIVATE_API_KEY }}

- name: Skip deployment message
if: steps.changes.outputs.content_changed == 'false'
Expand Down
32 changes: 22 additions & 10 deletions orama/upload_orama_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,28 @@ interface UploadOptions {
/**
* Load Orama configuration from environment variables
*/
function loadOramaConfig(): OramaConfig {
function loadOramaConfig(): OramaConfig | null {
const projectId = Deno.env.get("ORAMA_PROJECT_ID");
const datasourceId = Deno.env.get("ORAMA_DATASOURCE_ID");
const privateApiKey = Deno.env.get("ORAMA_PRIVATE_API_KEY");

if (!datasourceId || !privateApiKey || !projectId) {
console.error("❌ Missing required environment variables:");
console.error(" ORAMA_DATASOURCE_ID - Your Orama Cloud index ID");
console.error(" ORAMA_PROJECT_ID - Your Orama Cloud project ID");
console.error(
console.warn("⚠️ Missing required Orama Cloud environment variables:");
console.warn(" ORAMA_DATASOURCE_ID - Your Orama Cloud index ID");
console.warn(" ORAMA_PROJECT_ID - Your Orama Cloud project ID");
console.warn(
" ORAMA_PRIVATE_API_KEY - Your private API key for uploads",
);
console.error("");
console.error("Example:");
console.error(
console.warn("");
console.warn("This is expected for external contributors and forks.");
console.warn("The search index upload will be skipped.");
console.warn("");
console.warn("If you need to upload the search index, set these variables:");
console.warn(
' export ORAMA_DATASOURCE_ID="your-index-id"',
);
console.error(' export ORAMA_PRIVATE_API_KEY="your-private-api-key"');
Deno.exit(1);
console.warn(' export ORAMA_PRIVATE_API_KEY="your-private-api-key"');
return null;
}

return { datasourceId, privateApiKey, projectId };
Expand All @@ -81,6 +84,7 @@ interface IndexData {
[key: string]: unknown;
};
documents: OramaDocument[];
data?: OramaDocument[]; // Alternative property name for documents
}

interface OramaDocument {
Expand Down Expand Up @@ -253,6 +257,14 @@ async function main() {

// Load configuration
const config = loadOramaConfig();

// If config is null (missing API keys), skip upload but don't fail
if (!config) {
console.log("🔄 Skipping Orama search index upload due to missing configuration.");
console.log("This is normal for external contributors and forks.");
return;
}

console.log(`Target index: ${config.datasourceId}`);

// Determine input file path (auto-detect full vs minimal and _site vs static)
Expand Down