34
34
- name : Detect package manager
35
35
id : detect-package-manager
36
36
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
38
43
echo "manager=yarn" >> $GITHUB_OUTPUT
39
44
echo "command=install" >> $GITHUB_OUTPUT
40
45
echo "runner=yarn" >> $GITHUB_OUTPUT
53
58
with :
54
59
node-version : " 20"
55
60
cache : ${{ steps.detect-package-manager.outputs.manager }}
61
+ - name : Install pnpm
62
+ if : ${{ steps.detect-package-manager.outputs.manager == 'pnpm' }}
63
+ uses : pnpm/action-setup@v2
64
+ with :
65
+ version : ' 10.11.0'
56
66
- name : Setup Pages
57
67
uses : actions/configure-pages@v5
58
68
with :
@@ -67,10 +77,10 @@ jobs:
67
77
path : |
68
78
.next/cache
69
79
# 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('**/pnpm -lock.yaml ') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
71
81
# If source files changed but packages didn't, rebuild from a prior cache.
72
82
restore-keys : |
73
- ${{ runner.os }}-nextjs-${{ hashFiles('**/package -lock.json', '**/yarn.lock ') }}-
83
+ ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm -lock.yaml ') }}-
74
84
- name : Install dependencies
75
85
run : ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
76
86
- name : Build with Next.js
0 commit comments