Skip to content

Commit 8838381

Browse files
pnpm fix.
1 parent 33b20c8 commit 8838381

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed
Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 🐙 Deploy Next.js to GitHub Pages
1+
name: 🚀 Deploy Next.js to GitHub Pages
22

33
on:
44
push:
@@ -19,57 +19,48 @@ jobs:
1919
name: 🛠️ Build Next.js
2020
runs-on: ubuntu-latest
2121
steps:
22-
# Checkout code
2322
- name: 🔍 Checkout repository
2423
uses: actions/checkout@v4
2524

26-
# Detect package manager
2725
- name: 🔎 Detect package manager
2826
id: detect-pm
2927
run: |
30-
echo "🔍 Scanning for package manager..."
3128
if [ -f "pnpm-lock.yaml" ]; then
32-
echo "✅ Found pnpm lockfile"
3329
echo "manager=pnpm" >> $GITHUB_OUTPUT
3430
echo "command=install" >> $GITHUB_OUTPUT
3531
echo "runner=pnpm exec" >> $GITHUB_OUTPUT
3632
elif [ -f "yarn.lock" ]; then
37-
echo "✅ Found yarn lockfile"
3833
echo "manager=yarn" >> $GITHUB_OUTPUT
3934
echo "command=install" >> $GITHUB_OUTPUT
4035
echo "runner=yarn" >> $GITHUB_OUTPUT
41-
elif [ -f "package.json" ]; then
42-
echo "ℹ️ Using npm as fallback"
36+
else
4337
echo "manager=npm" >> $GITHUB_OUTPUT
4438
echo "command=ci" >> $GITHUB_OUTPUT
4539
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
46-
else
47-
echo "❌ No package manager detected!"
48-
exit 1
4940
fi
5041
51-
# Setup Node.js with automatic package manager installation
5242
- name: ⚙️ Setup Node.js
5343
uses: actions/setup-node@v4
5444
with:
5545
node-version: '20'
5646
cache: ${{ steps.detect-pm.outputs.manager }}
57-
package-manager: ${{ steps.detect-pm.outputs.manager }}
5847

59-
# Debugging step to verify installations
60-
- name: 📝 Check versions
48+
# New step to install pnpm if needed
49+
- name: 📦 Install Package Manager
50+
if: steps.detect-pm.outputs.manager == 'pnpm'
51+
run: npm install -g pnpm
52+
53+
- name: 📝 Verify Environment
6154
run: |
6255
echo "Node.js $(node -v)"
6356
echo "npm $(npm -v)"
6457
${{ steps.detect-pm.outputs.manager }} --version
6558
66-
# Configure GitHub Pages
6759
- name: 🌐 Setup Pages
6860
uses: actions/configure-pages@v5
6961
with:
7062
static_site_generator: next
7163

72-
# Cache management
7364
- name: 📦 Restore cache
7465
uses: actions/cache@v4
7566
with:
@@ -79,15 +70,12 @@ jobs:
7970
restore-keys: |
8071
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml') }}-
8172
82-
# Install dependencies
8373
- name: 📥 Install dependencies
8474
run: ${{ steps.detect-pm.outputs.manager }} ${{ steps.detect-pm.outputs.command }}
8575

86-
# Build project
8776
- name: 👷 Build with Next.js
8877
run: ${{ steps.detect-pm.outputs.runner }} next build
8978

90-
# Upload artifact
9179
- name: 📤 Upload artifact
9280
uses: actions/upload-pages-artifact@v3
9381
with:
@@ -101,6 +89,6 @@ jobs:
10189
runs-on: ubuntu-latest
10290
needs: build
10391
steps:
104-
- name: 🌍 Deploy to GitHub Pages
92+
- name: 🌍 Deploy
10593
id: deployment
10694
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)