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+         uses : actions/setup-node@v4 
37+         with :
38+           node-version : " lts/*" 
39+           cache : " bun" 
40+ 
41+       - name : Setup Pages 
42+         uses : actions/configure-pages@v4 
43+ 
44+       - name : Restore cache 
45+         uses : actions/cache@v4 
46+         with :
47+           path : | 
48+             .next/cache 
49+ #  Generate a new cache whenever packages or source files change.
50+           key : ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} 
51+           #  If source files changed but packages didn't, rebuild from a prior cache.
52+           restore-keys : | 
53+             ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- 
54+ 
55+ name : Install dependencies 
56+         run : bun install 
57+ 
58+       - name : Build with Next.js 
59+         run : bun next build 
60+ 
61+       - name : Upload artifact 
62+         uses : actions/upload-pages-artifact@v3 
63+         with :
64+           path : ./out 
65+ 
66+   #  Deployment job
67+   deploy :
68+     environment :
69+       name : github-pages 
70+       url : ${{ steps.deployment.outputs.page_url }} 
71+     runs-on : ubuntu-latest 
72+     needs : build 
73+     steps :
74+       - name : Deploy to GitHub Pages 
75+         id : deployment 
76+         uses : actions/deploy-pages@v4 
0 commit comments