File tree Expand file tree Collapse file tree 3 files changed +91
-2
lines changed Expand file tree Collapse file tree 3 files changed +91
-2
lines changed Original file line number Diff line number Diff line change
1
+ # Sample workflow for building and deploying a Next.js site to GitHub Pages
2
+ #
3
+ # To get started with Next.js see: https://nextjs.org/docs/getting-started
4
+ #
5
+ name : Deploy Next.js site to Pages
6
+
7
+ on :
8
+ # Runs on pushes targeting the default branch
9
+ push :
10
+ branches : ["main"]
11
+
12
+ # Allows you to run this workflow manually from the Actions tab
13
+ workflow_dispatch :
14
+
15
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16
+ permissions :
17
+ contents : read
18
+ pages : write
19
+ id-token : write
20
+
21
+ # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22
+ # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23
+ concurrency :
24
+ group : " pages"
25
+ cancel-in-progress : false
26
+
27
+ jobs :
28
+ # Build job
29
+ build :
30
+ runs-on : ubuntu-latest
31
+ steps :
32
+ - name : Checkout
33
+ uses : actions/checkout@v4
34
+
35
+ - name : Setup Node
36
+
37
+
38
+ with :
39
+ node-version : " 20.15"
40
+
41
+ - name : Install dependencies
42
+ run : npm install
43
+
44
+ - name : Setup Pages
45
+ uses : actions/configure-pages@v5
46
+ with :
47
+ static_site_generator : next
48
+ - name : Build with Next.js
49
+ run : npm run build
50
+ - name : Upload artifact
51
+ uses : actions/upload-pages-artifact@v3
52
+ with :
53
+ path : ./out
54
+
55
+ # Deployment job
56
+ deploy :
57
+ environment :
58
+ name : github-pages
59
+ url : ${{ steps.deployment.outputs.page_url }}
60
+ runs-on : ubuntu-latest
61
+ needs : build
62
+ steps :
63
+ - name : Deploy to GitHub Pages
64
+ id : deployment
65
+ uses : actions/deploy-pages@v4
Original file line number Diff line number Diff line change 1
1
/** @type {import('next').NextConfig } */
2
- const nextConfig : import ( "next" ) . NextConfig = { } ;
2
+ const nextConfig : import ( 'next' ) . NextConfig = {
3
+ /**
4
+ * Enable static exports for the App Router.
5
+ *
6
+ * @see https://nextjs.org/docs/app/building-your-application/deploying/static-exports
7
+ */
8
+ output : "export" ,
3
9
4
- export default nextConfig ;
10
+ /**
11
+ * Set base path. This is the slug of your GitHub repository.
12
+ *
13
+ * @see https://nextjs.org/docs/app/api-reference/next-config-js/basePath
14
+ */
15
+ basePath : "/nextjs-github-pages" ,
16
+
17
+ /**
18
+ * Disable server-based image optimization. Next.js does not support
19
+ * dynamic features with static exports.
20
+ *
21
+ * @see https://nextjs.org/docs/app/api-reference/components/image#unoptimized
22
+ */
23
+ images : {
24
+ unoptimized : true ,
25
+ } ,
26
+ } ;
27
+
28
+ export default nextConfig ;
You can’t perform that action at this time.
0 commit comments