3434 - name : Detect package manager
3535 id : detect-package-manager
3636 run : |
37- if [ -f "${{ github.workspace }}/yarn.lock" ]; then
37+ if [ -f "${{ github.workspace }}/pnpm-lock.yaml" ]; then
38+ echo "manager=pnpm" >> $GITHUB_OUTPUT
39+ echo "command=install" >> $GITHUB_OUTPUT
40+ echo "runner=pnpm" >> $GITHUB_OUTPUT
41+ exit 0
42+ elif [ -f "${{ github.workspace }}/yarn.lock" ]; then
3843 echo "manager=yarn" >> $GITHUB_OUTPUT
3944 echo "command=install" >> $GITHUB_OUTPUT
4045 echo "runner=yarn" >> $GITHUB_OUTPUT
4853 echo "Unable to determine package manager"
4954 exit 1
5055 fi
56+ - name : Setup pnpm
57+ if : steps.detect-package-manager.outputs.manager == 'pnpm'
58+ uses : pnpm/action-setup@v3
59+ with :
60+ version : 9
5161 - name : Setup Node
5262 uses : actions/setup-node@v4
5363 with :
@@ -67,10 +77,10 @@ jobs:
6777 path : |
6878 .next/cache
6979 # Generate a new cache whenever packages or source files change.
70- key : ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
80+ key : ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml' ) }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
7181 # If source files changed but packages didn't, rebuild from a prior cache.
7282 restore-keys : |
73- ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
83+ ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml' ) }}-
7484 - name : Install dependencies
7585 run : ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
7686 - name : Build with Next.js
0 commit comments