-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (37 loc) · 1.08 KB
/
deploy.yml
File metadata and controls
43 lines (37 loc) · 1.08 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
name: Deploy to VPS
on:
push:
branches: [main]
concurrency:
group: deploy
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy via SSH
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
script: |
cd /opt/apps/7uanf
# Pull latest changes
git fetch origin main
git reset --hard origin/main
# Build and restart container
docker compose build --no-cache
docker compose up -d --force-recreate --remove-orphans
# Wait for health check
echo "Waiting for health check..."
for i in $(seq 1 30); do
if curl -sf http://localhost:3002/api/health > /dev/null 2>&1; then
echo "App is healthy!"
exit 0
fi
sleep 2
done
echo "Health check failed!"
docker compose logs --tail=50
exit 1