Skip to content

Symbol dispose mechanism (#701) #78

Symbol dispose mechanism (#701)

Symbol dispose mechanism (#701) #78

name: πŸ”Ž Index Semantic Search (content)
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'content/blog/**'
- 'content/pages/**'
- 'content/data/**'
- 'app/routes/**'
- 'app/components/**'
- 'app/root.tsx'
- 'app/other-routes.server.ts'
- 'app/utils/sitemap.server.ts'
- 'other/semantic-search/**'
env:
# Set `SITE_CACHE_VERSION` as a repository variable so all workflows share one
# knob for invalidation.
SITE_CACHE_VERSION: ${{ vars.SITE_CACHE_VERSION }}
NODE_VERSION: 24
jobs:
index:
name: πŸ”Ž Index Semantic Search (content)
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: βŽ” Setup node
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
- name: πŸ“₯ Download deps
uses: bahmutov/npm-install@v1.11.2
- name: πŸ„ Copy test env vars
run: cp .env.example .env
- name: 🏦 Prime Site Cache
id: site-cache
uses: actions/cache@v5
with:
path: other/cache.db
# `other/cache.db` is a derived artifact. Key it off the inputs that can
# make it stale (content + cache/MDX code + deps), not `github.sha`.
key: >-
site-cache-mocks-${{ env.SITE_CACHE_VERSION }}-${{ runner.os
}}-node${{ env.NODE_VERSION }}-${{ hashFiles(
'package-lock.json',
'app/utils/cache.server.ts',
'app/utils/compile-mdx.server.ts',
'app/utils/github.server.ts',
'app/utils/markdown.server.ts',
'app/utils/mdx.server.ts',
'content/**',
'mocks/**'
) }}
restore-keys: |
site-cache-mocks-${{ env.SITE_CACHE_VERSION }}-${{ runner.os }}-node${{ env.NODE_VERSION }}-
- name: πŸ›  Setup Database (migrations)
if: steps.site-cache.outputs.cache-hit != 'true'
run: npx prisma migrate deploy
- name: πŸ— Build (production)
if: steps.site-cache.outputs.cache-hit != 'true'
run: npm run build
- name: πŸ˜… Generate Site Cache
if: steps.site-cache.outputs.cache-hit != 'true'
run: npm run prime-cache:mocks
- name: πŸ”Ž Index changed content
run: |
set -euo pipefail
node --env-file=.env other/semantic-search/index-repo-content.ts --before "${{ github.event.before }}" --after "${{ github.sha }}"
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_AI_GATEWAY_ID: ${{ secrets.CLOUDFLARE_AI_GATEWAY_ID }}
CLOUDFLARE_AI_GATEWAY_AUTH_TOKEN:
${{ secrets.CLOUDFLARE_AI_GATEWAY_AUTH_TOKEN }}
CLOUDFLARE_VECTORIZE_INDEX: ${{ secrets.CLOUDFLARE_VECTORIZE_INDEX }}
CLOUDFLARE_AI_EMBEDDING_MODEL:
${{ secrets.CLOUDFLARE_AI_EMBEDDING_MODEL }}
R2_BUCKET: ${{ secrets.R2_BUCKET }}