11name : Deploy Next.js site to Pages
22
33on :
4- # Runs on pushes targeting the default branch
4+ # Runs on pushes targeting the main branch
55 push :
6- branches : ["main"]
6+ branches :
7+ - main
78
89 # Allows you to run this workflow manually from the Actions tab
910 workflow_dispatch :
@@ -21,58 +22,52 @@ concurrency:
2122 cancel-in-progress : false
2223
2324jobs :
24- # Build job
2525 build :
2626 runs-on : ubuntu-latest
2727 steps :
2828 - name : Checkout
2929 uses : actions/checkout@v4
30-
31- - name : Setup Node.js
32- uses : actions/setup-node@v4
33- with :
34- node-version : ' 20'
35-
36- - name : Setup pnpm
37- uses : pnpm/action-setup@v3
30+
31+ - uses : pnpm/action-setup@v4
32+ name : Install pnpm
3833 with :
39- version : 8
34+ version : 10
4035 run_install : false
41-
42- - name : Get pnpm store directory
43- shell : bash
44- run : |
45- echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
46-
47- - name : Setup pnpm cache
48- uses : actions/cache@v4
36+
37+ - name : Install Node.js
38+ uses : actions/setup-node@v4
4939 with :
50- path : ${{ env.STORE_PATH }}
51- key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
52- restore-keys : |
53- ${{ runner.os }}-pnpm-store-
54-
40+ node-version : 22
41+ cache : ' pnpm'
42+
5543 - name : Install dependencies
56- run : pnpm install --frozen-lockfile
57-
44+ run : pnpm install
45+
5846 - name : Setup Pages
59- uses : actions/configure-pages@v4
47+ id : setup_pages
48+ uses : actions/configure-pages@v5
49+
50+ - name : Restore cache
51+ uses : actions/cache@v4
6052 with :
61- # Automatically inject basePath in your Next.js configuration file and disable
62- # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
63- #
64- # You may remove this line if you want to manage the configuration yourself.
65- static_exports : true
66-
53+ path : |
54+ .next/cache
55+ # Generate a new cache whenever packages or source files change.
56+ key : ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
57+ # If source files changed but packages didn't, rebuild from a prior cache.
58+ restore-keys : |
59+ ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
60+
6761 - name : Build with Next.js
68- run : pnpm build
69-
62+ run : pnpm run build
63+ env :
64+ PAGES_BASE_PATH : ${{ steps.setup_pages.outputs.base_path }}
65+
7066 - name : Upload artifact
7167 uses : actions/upload-pages-artifact@v3
7268 with :
7369 path : ./out
7470
75- # Deployment job
7671 deploy :
7772 environment :
7873 name : github-pages
8277 steps :
8378 - name : Deploy to GitHub Pages
8479 id : deployment
85- uses : actions/deploy-pages@v4
80+ uses : actions/deploy-pages@v4
0 commit comments