Skip to content

Commit 1205473

Browse files
committed
feat: migrate GitHub Actions workflow from yarn to pnpm
- Changed package manager detection from yarn.lock to pnpm-lock.yaml - Added pnpm/action-setup@v4 step with pnpm v9 - Updated cache keys to use pnpm-lock.yaml instead of yarn.lock - Maintains npm as fallback if pnpm-lock.yaml is not found
1 parent fa76b58 commit 1205473

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

.github/workflows/nextjs.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ jobs:
3434
- name: Detect package manager
3535
id: detect-package-manager
3636
run: |
37-
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
38-
echo "manager=yarn" >> $GITHUB_OUTPUT
37+
if [ -f "${{ github.workspace }}/pnpm-lock.yaml" ]; then
38+
echo "manager=pnpm" >> $GITHUB_OUTPUT
3939
echo "command=install" >> $GITHUB_OUTPUT
40-
echo "runner=yarn" >> $GITHUB_OUTPUT
40+
echo "runner=pnpm" >> $GITHUB_OUTPUT
4141
exit 0
4242
elif [ -f "${{ github.workspace }}/package.json" ]; then
4343
echo "manager=npm" >> $GITHUB_OUTPUT
@@ -48,6 +48,10 @@ jobs:
4848
echo "Unable to determine package manager"
4949
exit 1
5050
fi
51+
- name: Install pnpm
52+
uses: pnpm/action-setup@v4
53+
with:
54+
version: 9
5155
- name: Setup Node
5256
uses: actions/setup-node@v4
5357
with:
@@ -67,10 +71,10 @@ jobs:
6771
path: |
6872
.next/cache
6973
# 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') }}
74+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
7175
# If source files changed but packages didn't, rebuild from a prior cache.
7276
restore-keys: |
73-
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
77+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/pnpm-lock.yaml') }}-
7478
- name: Install dependencies
7579
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
7680
- name: Build with Next.js

0 commit comments

Comments
 (0)