Skip to content

Commit 23366a9

Browse files
committed
Enable deployment with NVM support for server
1 parent c6a7f0a commit 23366a9

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI/CD - PayAI Guardian
1+
name: Deploy PayAI Guardian
22

33
on:
44
push:
@@ -7,9 +7,6 @@ on:
77
branches: [main, master]
88
workflow_dispatch: # Allow manual trigger
99

10-
# Note: Deployment steps are currently disabled until server is configured
11-
# To enable deployment, change all 'if: false' to the proper condition
12-
1310
env:
1411
NODE_VERSION: '20'
1512

@@ -43,7 +40,7 @@ jobs:
4340
run: npm run build
4441

4542
- name: Deploy Frontend via SCP
46-
if: false # Disabled until server is configured
43+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
4744
uses: appleboy/scp-action@v0.1.7
4845
with:
4946
host: ${{ secrets.SERVER_HOST }}
@@ -93,7 +90,7 @@ jobs:
9390
run: npm run build:all
9491

9592
- name: Deploy Backend via SCP
96-
if: false # Disabled until server is configured
93+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
9794
uses: appleboy/scp-action@v0.1.7
9895
with:
9996
host: ${{ secrets.SERVER_HOST }}
@@ -106,13 +103,18 @@ jobs:
106103
exclude: "node_modules,.env,*.log,dist"
107104

108105
- name: Install Production Dependencies & Restart Services
109-
if: false # Disabled until server is configured
106+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
110107
uses: appleboy/ssh-action@v1.0.3
111108
with:
112109
host: ${{ secrets.SERVER_HOST }}
113110
username: ${{ secrets.SERVER_USER }}
114111
key: ${{ secrets.SERVER_SSH_KEY }}
115112
script: |
113+
# Load NVM (Node Version Manager)
114+
export NVM_DIR="$HOME/.nvm"
115+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
116+
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
117+
116118
cd ~/payai-guardian/server
117119
118120
# Install production dependencies for all services
@@ -223,7 +225,7 @@ jobs:
223225
name: Verify Deployment
224226
runs-on: ubuntu-latest
225227
needs: [frontend-deploy, backend-deploy]
226-
if: false # Disabled until server is configured
228+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
227229

228230
steps:
229231
- name: Wait for Services to Start

0 commit comments

Comments
 (0)