-
Notifications
You must be signed in to change notification settings - Fork 353
122 lines (109 loc) · 4.44 KB
/
deploy-orama-search.yml
File metadata and controls
122 lines (109 loc) · 4.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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@v2
with:
cache: true
- name: "Reference: install"
if: steps.changes.outputs.content_changed == 'true'
working-directory: "reference_gen"
run: deno install
- name: "Reference: generate types"
if: steps.changes.outputs.content_changed == 'true'
working-directory: "reference_gen"
run: deno task types
- name: "Reference: generate docs"
if: steps.changes.outputs.content_changed == 'true'
working-directory: "reference_gen"
run: deno task doc
- 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:search
- name: Upload and deploy to Orama Cloud
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 status
if: steps.changes.outputs.content_changed == 'true'
run: |
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'
run: |
echo "No content changes detected - search index deployment skipped"
echo "To force a deployment, use the 'workflow_dispatch' trigger with force_deploy=true"