File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -38,11 +38,17 @@ jobs:
3838 run : npm run test
3939
4040 - name : Build application
41- run : npm run build
41+ run : |
42+ echo "Building for branch: ${{ github.ref_name }}"
43+ echo "NODE_ENV: $NODE_ENV"
44+ echo "SURGE_PREVIEW: $SURGE_PREVIEW"
45+ npm run build
4246 env :
4347 NEXT_PUBLIC_GA_ID : ${{ secrets.NEXT_PUBLIC_GA_ID }}
4448 NEXT_PUBLIC_REQUIRE_CONSENT : true
4549 NEXT_PUBLIC_ANONYMIZE_IP : true
50+ # Set SURGE_PREVIEW for non-master branches to disable basePath
51+ SURGE_PREVIEW : ${{ github.ref != 'refs/heads/master' && 'true' || '' }}
4652
4753 - name : Upload Pages Artifact (Production)
4854 if : github.ref == 'refs/heads/master'
Original file line number Diff line number Diff line change @@ -4,8 +4,11 @@ const nextConfig: NextConfig = {
44 // Output as static site for GitHub Pages
55 output : 'export' ,
66
7- // Base path for GitHub Pages (only in production)
8- basePath : process . env . NODE_ENV === 'production' ? '/github-profile-readme-generator' : '' ,
7+ // Base path for GitHub Pages (only in production AND not for Surge previews)
8+ basePath :
9+ process . env . NODE_ENV === 'production' && ! process . env . SURGE_PREVIEW
10+ ? '/github-profile-readme-generator'
11+ : '' ,
912
1013 // Image optimization for static export
1114 images : {
You can’t perform that action at this time.
0 commit comments