Skip to content

Commit b07fdb8

Browse files
chore: add github workflows
1 parent 65289d2 commit b07fdb8

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Deploy Next.js to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main # 触发工作流的分支
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: '16' # 根据需要设置 Node.js 版本
20+
21+
- name: Install dependencies
22+
run: npm install -g pnpm && pnpm install
23+
24+
- name: Build and export
25+
run: pnpm run build && pnpm run export
26+
27+
- name: Deploy to GitHub Pages
28+
uses: peaceiris/actions-gh-pages@v3
29+
with:
30+
github_token: ${{ secrets.GITHUB_TOKEN }}
31+
publish_dir: ./out

next.config.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
2+
const nextConfig = {
3+
output: 'export',
4+
};
35

46
export default nextConfig;

0 commit comments

Comments
 (0)