Skip to content

Commit 6a20f01

Browse files
committed
Switch CI to build, enable export flags, add Octokit auth
Use the unified "build" script in the GitHub Actions workflow and remove the now-unused "build:static" script from package.json. Update next.config.mjs to set output based on isProd or isStaticExport and enable trailingSlash/skipped redirect when doing a static export. Pass GITHUB_TOKEN to Octokit in scripts/fetch-docs.ts so GitHub API requests are authenticated (reduces rate-limit issues and allows private repo access).
1 parent fea3d2d commit 6a20f01

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
static_site_generator: next
3939

4040
- name: Build with Next.js
41-
run: npm run build:static
41+
run: npm run build
4242
env:
4343
GITHUB_TOKEN: ${{ secrets.TOKEN }}
4444
NEXT_PUBLIC_SITE_URL: ${{ vars.NEXT_PUBLIC_SITE_URL || 'https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}' }}

next.config.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ const basePath =
1313

1414
/** @type {import('next').NextConfig} */
1515
const config = {
16-
output: process.env.NODE_ENV === "production" ? "export" : undefined,
16+
output: isProd || isStaticExport ? "export" : undefined,
1717
reactStrictMode: true,
1818
...(isStaticExport && {
19-
// output: "export",
2019
trailingSlash: true,
2120
skipTrailingSlashRedirect: true,
2221
basePath: basePath,

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"scripts": {
66
"build": "npm run fetch-docs && next build",
77
"build:cache": "npm run fetch-docs:cache && next build",
8-
"build:static": "npm run fetch-docs && next build",
98
"dev": "next dev",
109
"start": "serve out",
1110
"fetch-docs": "tsx scripts/fetch-docs.ts",

scripts/fetch-docs.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { writeFileSync, mkdirSync, existsSync, readFileSync } from 'fs';
33
import { join, dirname } from 'path';
44
import { config } from '../lib/config';
55

6-
const octokit = new Octokit();
6+
const octokit = new Octokit({
7+
auth: process.env.GITHUB_TOKEN,
8+
});
79

810
// Parse command line arguments
911
// Usage: tsx scripts/fetch-docs.ts [--cache-only|--offline]

0 commit comments

Comments
 (0)