-
Notifications
You must be signed in to change notification settings - Fork 2
95 lines (78 loc) · 2.98 KB
/
Copy pathbuild-index.yml
File metadata and controls
95 lines (78 loc) · 2.98 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
name: Build Codex Search Index
on:
push:
branches: [main]
workflow_dispatch:
jobs:
build-index:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '20'
- name: Restore SQL cache
uses: actions/cache@v5
with:
path: .cache/codex.db
# Cache key includes scripts so NLP changes invalidate cache
key: codex-cache-v2-${{ hashFiles('scripts/*.js', 'vocab/**/*.txt', 'weaves/**/*.md', 'docs/**/*.md', 'wiki/**/*.md') }}
restore-keys: |
codex-cache-v2-
- name: Install dependencies
run: npm install
- name: Process blocks (incremental)
run: |
# Get changed strand files from this push
CHANGED=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} -- 'weaves/**/*.md' 2>/dev/null || echo "")
if [ -n "$CHANGED" ]; then
echo "Processing changed strands:"
echo "$CHANGED"
node scripts/block-processor.js $CHANGED
else
echo "No strand changes detected or first run, processing all strands"
node scripts/block-processor.js --all
fi
- name: Build search index with SQL caching
run: |
# Run the enhanced auto-indexer with SQL diff cache
npm run index -- --validate
# Check if validation passed
if [ $? -ne 0 ]; then
echo "⚠️ Validation warnings found, but continuing with build"
fi
- name: Build block-level tags index
run: |
# Run build-index.mjs which generates codex-blocks.json
npm run build:index
echo "✓ Generated codex-blocks.json"
- name: Upload index artifacts
uses: actions/upload-artifact@v4
with:
name: codex-index
path: |
codex-index.json
codex-report.json
codex-blocks.json
- name: Create index branch
run: |
git config --global user.name 'Frame Dev Bot'
git config --global user.email 'team@frame.dev'
# Create or checkout index branch
git checkout -B index
# Copy the index files
cp codex-index.json index.json
cp codex-report.json report.json
# Copy block-level tags index (generated by build-index.mjs)
if [ -f codex-blocks.json ]; then
cp codex-blocks.json blocks.json
echo "✓ Block tags index included"
else
echo "⚠️ codex-blocks.json not found, skipping"
fi
# Commit and push
git add index.json report.json blocks.json 2>/dev/null || git add index.json report.json
git commit -m "chore: update search index, report, and block tags [skip ci]" || echo "No changes to commit"
git push origin index --force