Skip to content

Commit adac8b4

Browse files
committed
ci: refactor build workflow and add docsearch integration
1 parent 97452aa commit adac8b4

File tree

3 files changed

+99
-23
lines changed

3 files changed

+99
-23
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "Setup Node with PNPM"
2+
description: "Checkout, setup Node, configure PNPM and install dependencies"
3+
4+
inputs:
5+
node-version:
6+
description: "Node.js version"
7+
required: true
8+
default: "22"
9+
10+
pnpm-version:
11+
description: "PNPM version"
12+
required: false
13+
default: "latest"
14+
15+
runs:
16+
using: "composite"
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Install Node
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ inputs.node-version }}
27+
cache: 'pnpm'
28+
29+
- name: Install PNPM
30+
run: npm i pnpm@latest -g
31+
shell: bash
32+
33+
- name: Setup npmrc
34+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
35+
shell: bash
36+
37+
- name: Setup pnpm config
38+
run: pnpm config set store-dir $PNPM_CACHE_FOLDER
39+
shell: bash
40+
41+
- name: Install Package
42+
run: pnpm install
43+
shell: bash

.github/workflows/build.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,26 @@ jobs:
1212
if: github.repository == 'my-mcp-hub/mcp-kit'
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v4
17-
with:
18-
fetch-depth: 0
19-
20-
- name: Install Node
21-
uses: actions/setup-node@v4
15+
- uses: ./.github/actions/setup-pnpm
2216
with:
2317
node-version: 22
2418

25-
- name: Install PNPM
26-
run: npm i pnpm@latest -g
27-
28-
- name: Setup npmrc
29-
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
19+
- name: Build Package
20+
run: pnpm run build
3021

31-
- name: setup pnpm config
32-
run: pnpm config set store-dir $PNPM_CACHE_FOLDER
22+
- name: Test Package
23+
run: pnpm run coverage
3324

34-
- name: Install Package
35-
run: pnpm install
25+
- name: Coveralls
26+
uses: coverallsapp/github-action@v2
3627

37-
- name: Build Package
38-
run: pnpm run build
28+
doc:
29+
if: github.repository == 'my-mcp-hub/mcp-kit'
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: ./.github/actions/setup-pnpm
33+
with:
34+
node-version: 22
3935

4036
- name: Build Docs Package
4137
run: pnpm run docs:build
@@ -46,8 +42,12 @@ jobs:
4642
github_token: ${{ secrets.GITHUB_TOKEN }}
4743
publish_dir: docs/.vitepress/dist
4844

49-
- name: Test Package
50-
run: pnpm run coverage
51-
52-
- name: Coveralls
53-
uses: coverallsapp/github-action@v2
45+
- name: Get the content of algolia.json as config
46+
id: algolia_config
47+
run: echo "config=$(cat docs/crawlerConfig.json | jq -r tostring)" >> $GITHUB_OUTPUT
48+
- name: Push indices to Algolia
49+
uses: signcl/docsearch-scraper-action@master
50+
env:
51+
APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
52+
API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
53+
CONFIG: ${{ steps.algolia_config.outputs.config }}

docs/crawlerConfig.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"index_name": "create-mcp-kit",
3+
"start_urls": ["https://my-mcp-hub.github.io/mcp-kit/"],
4+
"rateLimit": 8,
5+
"maxDepth": 10,
6+
"selectors": {
7+
"lvl0": {
8+
"selector": "",
9+
"defaultValue": "Documentation"
10+
},
11+
"lvl1": ".content h1",
12+
"lvl2": ".content h2",
13+
"lvl3": ".content h3",
14+
"lvl4": ".content h4",
15+
"lvl5": ".content h5",
16+
"content": ".content p, .content li",
17+
"lang": {
18+
"selector": "/html/@lang",
19+
"type": "xpath",
20+
"global": true
21+
}
22+
},
23+
"selectors_exclude": [
24+
"aside",
25+
".page-footer",
26+
".next-and-prev-link",
27+
".table-of-contents"
28+
],
29+
"custom_settings": {
30+
"attributesForFaceting": ["lang", "tags"]
31+
},
32+
"js_render": true
33+
}

0 commit comments

Comments
 (0)