@@ -3,7 +3,7 @@ name: Deploy Next.js site to Pages
33on :
44 # Runs on pushes targeting the default branch
55 push :
6- branches : ["main"]
6+ branches : ["main", "upgrade" ]
77
88 # Allows you to run this workflow manually from the Actions tab
99 workflow_dispatch :
2525 runs-on : ubuntu-latest
2626 steps :
2727 - name : Checkout
28- uses : actions/checkout@v3
28+ uses : actions/checkout@v4
29+
30+ - name : Install Pnpm
31+ uses : pnpm/action-setup@v4
32+ with :
33+ version : 9
34+
2935 - name : Detect package manager
3036 id : detect-package-manager
3137 run : |
@@ -34,46 +40,49 @@ jobs:
3440 echo "command=install" >> $GITHUB_OUTPUT
3541 echo "runner=yarn" >> $GITHUB_OUTPUT
3642 exit 0
43+ elif [ -f "${{ github.workspace }}/pnpm-lock.yaml" ]; then
44+ echo "manager=pnpm" >> $GITHUB_OUTPUT
45+ echo "command=install" >> $GITHUB_OUTPUT
46+ echo "runner=pnpm" >> $GITHUB_OUTPUT
47+ exit 0
3748 elif [ -f "${{ github.workspace }}/package.json" ]; then
3849 echo "manager=npm" >> $GITHUB_OUTPUT
3950 echo "command=ci" >> $GITHUB_OUTPUT
4051 echo "runner=npx --no-install" >> $GITHUB_OUTPUT
4152 exit 0
4253 else
43- echo "Unable to determine packager manager"
54+ echo "Unable to determine package manager"
4455 exit 1
4556 fi
4657 - name : Setup Node
47- uses : actions/setup-node@v3
58+ uses : actions/setup-node@v4
4859 with :
49- node-version : " 16 "
60+ node-version : " 20 "
5061 cache : ${{ steps.detect-package-manager.outputs.manager }}
5162 - name : Setup Pages
52- uses : actions/configure-pages@v3
63+ uses : actions/configure-pages@v5
5364 with :
5465 # Automatically inject basePath in your Next.js configuration file and disable
5566 # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
5667 #
5768 # You may remove this line if you want to manage the configuration yourself.
5869 static_site_generator : next
5970 - name : Restore cache
60- uses : actions/cache@v3
71+ uses : actions/cache@v4
6172 with :
6273 path : |
6374 .next/cache
6475 # Generate a new cache whenever packages or source files change.
65- key : ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
76+ key : ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml' ) }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
6677 # If source files changed but packages didn't, rebuild from a prior cache.
6778 restore-keys : |
68- ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
79+ ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml' ) }}-
6980 - name : Install dependencies
7081 run : ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
7182 - name : Build with Next.js
7283 run : ${{ steps.detect-package-manager.outputs.runner }} next build
73- - name : Static HTML export with Next.js
74- run : ${{ steps.detect-package-manager.outputs.runner }} next export
7584 - name : Upload artifact
76- uses : actions/upload-pages-artifact@v1
85+ uses : actions/upload-pages-artifact@v3
7786 with :
7887 path : ./out
7988
8796 steps :
8897 - name : Deploy to GitHub Pages
8998 id : deployment
90- uses : actions/deploy-pages@v1
99+ uses : actions/deploy-pages@v4
0 commit comments