-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (30 loc) · 1.1 KB
/
deploy.yml
File metadata and controls
38 lines (30 loc) · 1.1 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
name: Zero Downtime Deploy
on:
workflow_run:
workflows: ["Docker Image CI"]
types:
- completed
jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Deploy via SSH (Docker Compose)
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
script: |
set -e
cd /home/ubuntu/github/StudentTracker-Pro
echo "🚀 Pulling latest code and images..."
sudo chown -R ubuntu:ubuntu /home/ubuntu/github/StudentTracker-Pro
git config --global --add safe.directory /home/ubuntu/github/StudentTracker-Pro
git pull origin master
sudo docker compose pull
echo "🆕 Updating services..."
sudo docker compose up -d
echo "🧹 Cleaning up old images..."
sudo docker image prune -f
echo "✅ Deployment complete!"