77 pull_request :
88 branches :
99 - main
10+ workflow_dispatch :
1011
11- # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1212permissions :
1313 contents : read
1414 pages : write
1515 id-token : write
1616
17- # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
18- # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
1917concurrency :
2018 group : " pages"
2119 cancel-in-progress : false
2220
2321jobs :
24- # Build job
2522 build :
2623 runs-on : ubuntu-latest
2724 steps :
28- - name : Checkout
25+ - name : Checkout repository
2926 uses : actions/checkout@v4
3027
3128 - name : Setup Node.js
3229 uses : actions/setup-node@v4
3330 with :
34- node-version : ' 20 '
31+ node-version : 22
3532 cache : ' npm'
3633
3734 - name : Install dependencies
3835 run : npm ci
3936
40- - name : Build Next.js application
37+ - name : Setup Pages
38+ id : setup_pages
39+ uses : actions/configure-pages@v5
40+
41+ - name : Restore Next.js build cache
42+ uses : actions/cache@v4
43+ with :
44+ path : .next/cache
45+ key : ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx', '**/*.ts', '**/*.tsx') }}
46+ restore-keys : |
47+ ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
48+
49+ - name : Build (GitHub Pages)
50+ # Ensure your build script outputs static assets to ./out
51+ # If needed, set output: 'export' in next.config.js
4152 run : npm run build:github-pages
53+ env :
54+ PAGES_BASE_PATH : ${{ steps.setup_pages.outputs.base_path }}
4255
4356 - name : Add .nojekyll file
4457 run : |
@@ -50,18 +63,19 @@ jobs:
5063 - name : Debug build output
5164 run : |
5265 echo "Build output structure:"
53- ls -la out/
54- echo "Checking _next directory:"
55- ls -la out/_next/
56- echo "Checking static assets:"
57- ls -la out/_next/static/chunks/ | head -5
66+ ls -la out/
67+ echo "Checking _next directory (if present):"
68+ ls -la out/_next/ || echo "_next directory not found (ensure static export)."
69+ if [ -d out/_next/static/chunks ]; then
70+ echo "Checking static chunks:"
71+ ls -la out/_next/static/chunks/ | head -20
72+ fi
5873
5974 - name : Upload artifact
6075 uses : actions/upload-pages-artifact@v3
6176 with :
6277 path : ./out
6378
64- # Deployment job
6579 deploy :
6680 environment :
6781 name : github-pages
0 commit comments