File tree Expand file tree Collapse file tree 8 files changed +50
-9
lines changed Expand file tree Collapse file tree 8 files changed +50
-9
lines changed Original file line number Diff line number Diff line change 1+ name : Update Search Index
2+
3+ on :
4+ push :
5+ # Run when merging from official repo to check if translations are outdated
6+ branches :
7+ - main
8+ workflow_dispatch : # Allow manual triggering
9+
10+ # Add permissions needed for creating PRs
11+ permissions :
12+ contents : write
13+
14+ jobs :
15+ translate :
16+ runs-on : ubuntu-latest
17+ steps :
18+ # Checkout the repository first to access local actions
19+ - name : Checkout code
20+ uses : actions/checkout@v3
21+ with :
22+ fetch-depth : 1
23+ - name : Setup Tools
24+ uses : ./.github/actions/setup
25+ - name : Build docs app
26+ shell : bash
27+ run : pnpm build:docs
28+ - name : Run search index update
29+ shell : bash
30+ run : pnpm run update-search-index
31+ env :
32+ ORAMA_PRIVATE_API_KEY_EN : ${{ secrets.ORAMA_PRIVATE_API_KEY_EN }}
33+ ORAMA_PRIVATE_API_KEY_ZH_HANS : ${{ secrets.ORAMA_PRIVATE_API_KEY_ZH_HANS }}
34+
Original file line number Diff line number Diff line change 11EN_DOMAIN = nextjs.im
22ZH_HANS_DOMAIN = zh-hans.nextjs.im
3- ORAMA_PRIVATE_API_KEY =
3+ ORAMA_PRIVATE_API_KEY_EN =
4+ ORAMA_PRIVATE_API_KEY_ZH_HANS =
Original file line number Diff line number Diff line change 44 "private" : true ,
55 "scripts" : {
66 "build" : " next build" ,
7- "build:post " : " tsx ./scripts/post-build .mts" ,
7+ "update-search-index " : " tsx ./scripts/update-search-index .mts" ,
88 "dev" : " next dev --turbo" ,
99 "start" : " next start" ,
1010 "postinstall" : " fumadocs-mdx" ,
Original file line number Diff line number Diff line change @@ -8,8 +8,11 @@ import { sync } from '../src/lib/orama/orama-cloud';
88export async function updateSearchIndexes ( ) : Promise < void > {
99 for ( const item of ORAMA_CONFIGS ) {
1010 const { locale, privateKey, index } = item ;
11+ if ( ! privateKey ) {
12+ console . error ( `No private key found for locale: ${ locale } ` ) ;
13+ continue ;
14+ }
1115 const manager = new CloudManager ( { api_key : privateKey } ) ;
12-
1316 // Get all .body files in the static directory
1417 const staticDir = path . join ( `.next/server/app/${ locale } /static` ) ;
1518 let allRecords : OramaDocument [ ] = [ ] ;
File renamed without changes.
Original file line number Diff line number Diff line change 11import type { Locale } from 'next-intl' ;
2- // PrivateApiKey is only used in the server
3- const privateApiKey = process . env . ORAMA_PRIVATE_API_KEY ;
42
53const ORAMA_EN_CONFIG = {
64 locale : 'en' ,
7- privateKey : privateApiKey || '' ,
5+ privateKey : process . env . ORAMA_PRIVATE_API_KEY_EN || '' ,
86 apiKey : '4DujbZrvGuklBRFcZBtegX3fV1lzNXnU' ,
97 index : 'vuywlowcbl1w3s2jtvq5ysxl' ,
108 endpoint : 'https://cloud.orama.run/v1/indexes/en-ai00ky' ,
@@ -14,7 +12,7 @@ type ORAMA_EN_CONFIG = typeof ORAMA_EN_CONFIG;
1412
1513const OORAMA_ZH_HANS_CONFIG = {
1614 locale : 'zh-Hans' ,
17- privateKey : privateApiKey || '' ,
15+ privateKey : process . env . ORAMA_PRIVATE_API_ZH_HANS || '' ,
1816 apiKey : '6nEUS4tyXiajWxZ8qMEQMzzLoOYTuLSk' ,
1917 index : 'vcwl00bwd64h3pa8yq8x107y' ,
2018 endpoint : 'https://cloud.orama.run/v1/indexes/zh-hans-js5ujm' ,
Original file line number Diff line number Diff line change @@ -31,7 +31,10 @@ export async function sync(
3131 ) ;
3232 await index . insert ( chunk ) ;
3333 }
34- if ( autoDeploy ) await index . deploy ( ) ;
34+ if ( autoDeploy ) {
35+ console . log ( 'Deploying index...' ) ;
36+ await index . deploy ( ) ;
37+ }
3538 console . log ( 'All operations completed' ) ;
3639}
3740
Original file line number Diff line number Diff line change 99 "lint" : " biome lint ." ,
1010 "lint:fix" : " biome lint --write ." ,
1111 "dev" : " pnpm --filter @next-i18n/translate --filter @next-i18n/docs --parallel dev" ,
12- "translate" : " pnpm --filter @next-i18n/docs translate"
12+ "translate" : " pnpm --filter @next-i18n/docs translate" ,
13+ "build:docs" : " pnpm --filter @next-i18n/docs build" ,
14+ "update-search-index" : " pnpm --filter @next-i18n/docs update-search-index"
1315 },
1416 "keywords" : [],
1517 "devDependencies" : {
You can’t perform that action at this time.
0 commit comments