Skip to content

Commit aa2a4c8

Browse files
committed
continue fix the bug
1 parent 7a82fc8 commit aa2a4c8

2 files changed

Lines changed: 22 additions & 10 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ jobs:
3232
--include '.env*' \
3333
--exclude node_modules \
3434
--exclude .git \
35+
--exclude .github \
3536
--exclude build-output \
3637
--exclude '.*'
3738
echo "📁 Build output content:"
3839
ls -la build-output
3940
40-
- name: 📤 Upload build-output to server
41+
- name: 📤 Upload app files to server
4142
uses: appleboy/scp-action@v0.1.7
4243
with:
4344
host: ${{ secrets.SSH_HOST }}
@@ -49,6 +50,18 @@ jobs:
4950
overwrite: true
5051
strip_components: 0
5152

53+
- name: 📦 Upload node_modules to nodevenv
54+
uses: appleboy/scp-action@v0.1.7
55+
with:
56+
host: ${{ secrets.SSH_HOST }}
57+
username: ${{ secrets.SSH_USER }}
58+
key: ${{ secrets.SSH_PRIVATE_KEY }}
59+
passphrase: ${{ secrets.SSH_PASSPHRASE }}
60+
source: "node_modules/*"
61+
target: ${{ secrets.NODE_MODULES_DIR }}
62+
overwrite: true
63+
strip_components: 0
64+
5265
- name: ⚙️ Deploy on server
5366
uses: appleboy/ssh-action@v1.2.0
5467
with:
@@ -61,17 +74,16 @@ jobs:
6174
bash -lc '
6275
echo "🔧 Activating environment..."
6376
source /home/devstudi/nodevenv/autodeploy/22/bin/activate
64-
cd /home/devstudi/autodeploy
77+
cd ${{ secrets.DEPLOY_DIR }}
6578
6679
echo "📦 Moving files out of build-output..."
67-
mv build-output/* . || true
68-
rm -rf build-output
69-
70-
echo "📦 Installing production dependencies..."
71-
npm ci --omit=dev
80+
if [ -d "build-output" ]; then
81+
mv build-output/* . || true
82+
rm -rf build-output
83+
fi
7284
7385
echo "♻️ Restarting Node.js app..."
7486
touch tmp/restart.txt || true
7587
7688
echo "✅ Deployment complete!"
77-
'
89+
'

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"private": true,
66
"scripts": {
77
"dev": "next dev",
8-
"build": "next build",
9-
"start": "next start",
8+
"build": "NODE_ENV=production next build",
9+
"start": "NODE_ENV=production next start",
1010
"lint": "eslint"
1111
},
1212
"dependencies": {

0 commit comments

Comments
 (0)