@@ -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 }}
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+ '
0 commit comments