Skip to content

Commit 5ac052f

Browse files
committed
feat: move update-search-index to release
1 parent 93f61d7 commit 5ac052f

File tree

2 files changed

+34
-30
lines changed

2 files changed

+34
-30
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ jobs:
1616
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_EN_ID }}
1717
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1818
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
19+
20+
update-search-index-en:
21+
needs: deploy-en
22+
uses: ./.github/workflows/update-search-index.yml
23+
with:
24+
locale: en
25+
secrets:
26+
ORAMA_PRIVATE_API_KEY_EN: ${{ secrets.ORAMA_PRIVATE_API_KEY_EN }}
27+
ORAMA_PRIVATE_API_KEY_ZH_HANS: ${{ secrets.ORAMA_PRIVATE_API_KEY_ZH_HANS }}
1928

2029
deploy-zh-hans:
2130
uses: ./.github/workflows/vercel-deploy.yml
@@ -26,3 +35,12 @@ jobs:
2635
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ZH_HANS_ID }}
2736
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
2837
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
38+
39+
update-search-index-zh-hans:
40+
needs: deploy-zh-hans
41+
uses: ./.github/workflows/update-search-index.yml
42+
with:
43+
locale: zh-hans
44+
secrets:
45+
ORAMA_PRIVATE_API_KEY_EN: ${{ secrets.ORAMA_PRIVATE_API_KEY_EN }}
46+
ORAMA_PRIVATE_API_KEY_ZH_HANS: ${{ secrets.ORAMA_PRIVATE_API_KEY_ZH_HANS }}
Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,42 @@
11
name: Update Search Index
22

33
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
4+
workflow_call:
5+
inputs:
6+
locale:
7+
description: "Locale to update (e.g., 'en' or 'zh-hans')"
8+
required: true
9+
type: string
10+
secrets:
11+
ORAMA_PRIVATE_API_KEY_EN:
12+
required: true
13+
ORAMA_PRIVATE_API_KEY_ZH_HANS:
14+
required: true
1315

1416
jobs:
1517
update-search-index:
1618
runs-on: ubuntu-latest
1719
steps:
18-
# Checkout the repository first to access local actions
1920
- name: Checkout code
2021
uses: actions/checkout@v3
2122
with:
2223
fetch-depth: 1
2324
- name: Setup Tools
2425
uses: ./.github/actions/setup
2526

26-
- name: Build docs/zh-hans
27+
- name: Build docs
2728
shell: bash
2829
run: pnpm build:docs
2930
env:
30-
LOCALE: "zh-hans"
31+
LOCALE: "${{ inputs.locale }}"
3132
GEN_ORAMA_STATIC: "true"
32-
MDX_ASYNC: "false"
33+
MDX_ASYNC: "true"
3334
NODE_OPTIONS: "--max-old-space-size=8192"
34-
- name: Update Search Index (zh-hans)
35-
shell: bash
36-
run: pnpm run update-search-index
37-
env:
38-
LOCALE: "zh-hans"
39-
ORAMA_PRIVATE_API_KEY_EN: ${{ secrets.ORAMA_PRIVATE_API_KEY_EN }}
40-
ORAMA_PRIVATE_API_KEY_ZH_HANS: ${{ secrets.ORAMA_PRIVATE_API_KEY_ZH_HANS }}
4135

42-
- name: Build docs/en
43-
shell: bash
44-
run: pnpm build:docs
45-
env:
46-
LOCALE: "en"
47-
GEN_ORAMA_STATIC: "true"
48-
MDX_ASYNC: "false"
49-
NODE_OPTIONS: "--max-old-space-size=8192"
50-
- name: Update Search Index (en)
36+
- name: Update Search Index
5137
shell: bash
5238
run: pnpm run update-search-index
5339
env:
54-
LOCALE: "en"
40+
LOCALE: "${{ inputs.locale }}"
5541
ORAMA_PRIVATE_API_KEY_EN: ${{ secrets.ORAMA_PRIVATE_API_KEY_EN }}
5642
ORAMA_PRIVATE_API_KEY_ZH_HANS: ${{ secrets.ORAMA_PRIVATE_API_KEY_ZH_HANS }}

0 commit comments

Comments
 (0)