-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfullstack-deploy.yml
More file actions
51 lines (43 loc) · 1.23 KB
/
Copy pathfullstack-deploy.yml
File metadata and controls
51 lines (43 loc) · 1.23 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# .github/workflows/deploy.yml
# Copy this to each full-stack Vite + Express repo
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Build frontend
run: |
npm ci
npm run build
env:
# Add VITE_ prefixed env vars here as GitHub secrets
# VITE_WHATEVER: ${{ secrets.VITE_WHATEVER }}
- name: Deploy frontend
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.SERVER_HOST }}
username: deploy
key: ${{ secrets.SSH_DEPLOY_KEY }}
source: "dist/"
target: "/srv/server/static/YOUR_SITE_NAME"
strip_components: 1
- name: Deploy backend
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.SERVER_HOST }}
username: deploy
key: ${{ secrets.SSH_DEPLOY_KEY }}
script: |
cd /srv/server/node/YOUR_SITE_NAME
git pull origin main
npm ci --omit=dev
docker exec node pm2 restart YOUR_SITE_NAME