This repository was archived by the owner on Apr 27, 2026. It is now read-only.
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 Next.js to GitHub Pages
2+
3+ on :
4+ push :
5+ branches :
6+ - main # Trigger only on pushes to main
7+
8+ jobs :
9+ build-and-deploy :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ # Step 1: Checkout the repository
14+ - name : Checkout repository
15+ uses : actions/checkout@v3
16+
17+ # Step 2: Setup Node.js
18+ - name : Setup Node.js
19+ uses : actions/setup-node@v3
20+ with :
21+ node-version : ' lts'
22+ cache : ' npm'
23+
24+ # Step 3: Install dependencies
25+ - name : Install dependencies
26+ run : npm install
27+
28+ # Step 4: Build Next.js project
29+ - name : Build Next.js app
30+ run : npx next build
31+
32+ # Step 5: Clean up old public folder HTML and subdirectories
33+ - name : Clean up public folder
34+ run : |
35+ find public -mindepth 1 -maxdepth 1 -type d | xargs rm -rf || true
36+ find public -type f -name "*.html" | xargs rm -rf || true
37+
38+ # Step 6: Move build output to public folder
39+ - name : Move build artifacts
40+ run : mv -f kinact-package/* public
41+
42+ # Step 7: Deploy to GitHub Pages
43+ - name : Deploy to GitHub Pages
44+ uses : peaceiris/actions-gh-pages@v3
45+ with :
46+ github_token : ${{ secrets.GITHUB_TOKEN }}
47+ publish_dir : ./public
File renamed without changes.
You can’t perform that action at this time.
0 commit comments