File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Deploy docs to GitHub Pages
2+
3+ on :
4+ push :
5+ branches : [main]
6+ paths :
7+ - ' website/**'
8+ - ' .github/workflows/deploy-pages.yml'
9+ workflow_dispatch :
10+
11+ permissions :
12+ contents : read
13+ pages : write
14+ id-token : write
15+
16+ # One Pages deployment at a time; don't cancel an in-progress publish.
17+ concurrency :
18+ group : pages
19+ cancel-in-progress : false
20+
21+ jobs :
22+ build :
23+ runs-on : ubuntu-latest
24+ steps :
25+ - uses : actions/checkout@v4
26+ - name : Enable GitHub Pages (Actions source)
27+ uses : actions/configure-pages@v5
28+ with :
29+ enablement : true
30+ - uses : actions/setup-node@v4
31+ with :
32+ node-version : ' 20'
33+ cache : ' npm'
34+ cache-dependency-path : website/package-lock.json
35+ - name : Install deps
36+ working-directory : website
37+ run : npm install
38+ - name : Build static export
39+ working-directory : website
40+ env :
41+ # Project Pages site is served under /<repo>/.
42+ NEXT_PUBLIC_BASE_PATH : /repolens
43+ run : npm run build
44+ - name : Disable Jekyll (serve _next/ as-is)
45+ run : touch website/out/.nojekyll
46+ - uses : actions/upload-pages-artifact@v3
47+ with :
48+ path : website/out
49+
50+ deploy :
51+ needs : build
52+ runs-on : ubuntu-latest
53+ environment :
54+ name : github-pages
55+ url : ${{ steps.deployment.outputs.page_url }}
56+ steps :
57+ - id : deployment
58+ uses : actions/deploy-pages@v4
Original file line number Diff line number Diff line change 11import { createFromSource } from 'fumadocs-core/search/server' ;
22import { source } from '@/lib/source' ;
33
4- // Builds the search index from the docs source (now that lib/source resolves files correctly).
5- export const { GET } = createFromSource ( source ) ;
4+ // Static search index so the docs export to plain HTML (`output: export`) for
5+ // GitHub Pages. The client (app/layout.tsx) is configured for static search.
6+ export const revalidate = false ;
7+
8+ export const { staticGET : GET } = createFromSource ( source ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ import type { ReactNode } from 'react';
22import { RootProvider } from 'fumadocs-ui/provider' ;
33import './global.css' ;
44
5+ // On GitHub Pages the static export is served under /<repo>/, so the static search
6+ // index lives at <basePath>/api/search. Empty when served at root (local dev).
7+ const basePath = process . env . NEXT_PUBLIC_BASE_PATH ?? '' ;
8+
59export const metadata = {
610 title : 'RepoLens — read code before you trust it' ,
711 description :
@@ -12,7 +16,9 @@ export default function RootLayout({ children }: { children: ReactNode }) {
1216 return (
1317 < html lang = "en" suppressHydrationWarning >
1418 < body >
15- < RootProvider > { children } </ RootProvider >
19+ < RootProvider search = { { options : { type : 'static' , api : `${ basePath } /api/search` } } } >
20+ { children }
21+ </ RootProvider >
1622 </ body >
1723 </ html >
1824 ) ;
Original file line number Diff line number Diff line change @@ -2,9 +2,17 @@ import { createMDX } from 'fumadocs-mdx/next';
22
33const withMDX = createMDX ( ) ;
44
5+ // On GitHub Pages a project site is served under /<repo>/, so CI sets
6+ // NEXT_PUBLIC_BASE_PATH=/repolens. Locally it's unset (served at root).
7+ const basePath = process . env . NEXT_PUBLIC_BASE_PATH || undefined ;
8+
59/** @type {import('next').NextConfig } */
610const config = {
711 reactStrictMode : true ,
12+ output : 'export' , // static HTML export — hostable on GitHub Pages / any static host
13+ images : { unoptimized : true } , // required by `output: export`
14+ basePath,
15+ trailingSlash : false , // rely on GitHub Pages serving `foo.html` for `/foo`
816} ;
917
1018export default withMDX ( config ) ;
You can’t perform that action at this time.
0 commit comments