-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode-deploy.yml
More file actions
36 lines (30 loc) · 937 Bytes
/
Copy pathnode-deploy.yml
File metadata and controls
36 lines (30 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# .github/workflows/deploy.yml
# Copy this to your Node/Express service repo
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy files
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ vars.SERVER_HOST }}
username: deploy
key: ${{ secrets.SSH_DEPLOY_KEY }}
source: ".,!.git,!node_modules,!.env"
target: /srv/server/node/YOUR_SERVICE_NAME
strip_components: 1
overwrite: true
- name: Install and restart
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ vars.SERVER_HOST }}
username: deploy
key: ${{ secrets.SSH_DEPLOY_KEY }}
script: |
docker exec node sh -c "cd /app/YOUR_SERVICE_NAME && npm install --omit=dev"
docker exec node pm2 restart YOUR_SERVICE_NAME