Skip to content

Commit fef0f16

Browse files
committed
Configure Next.js for static export and add GitHub Pages deployment workflow
1 parent 16f08f1 commit fef0f16

8 files changed

Lines changed: 36 additions & 6 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Deploy Next.js to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '22'
18+
19+
- name: Install dependencies
20+
run: npm ci
21+
22+
- name: Build and Generate static site
23+
run: npm run build
24+
25+
- name: Deploy to GitHub Pages
26+
uses: JamesIves/github-pages-deploy-action@v4
27+
with:
28+
branch: gh-pages
29+
folder: out

next.config.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
2+
const nextConfig = {
3+
output: 'export', // enables static export -> builds into "out/"
4+
trailingSlash: true, // creates folder/index.html structure (safer on GitHub Pages)
5+
images: { unoptimized: true }, // disable Next.js image optimizer (server-only feature)
6+
basePath: '', // empty because this is the *root* user site
7+
assetPrefix: undefined
8+
};
39

410
export default nextConfig;

public/.nojekyll

Whitespace-only changes.

public/file.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/globe.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/next.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/vercel.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/window.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)