File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Deploy to VPS
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ deploy :
10+ name : Deploy via SSH
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - name : Checkout Code
15+ uses : actions/checkout@v4
16+
17+ - name : Deploy to VPS
18+ uses : appleboy/ssh-action@v1.0.3
19+ with :
20+ host : ${{ secrets.VPS_HOST }}
21+ username : ${{ secrets.VPS_USER }}
22+ key : ${{ secrets.VPS_SSH_KEY }}
23+ port : ${{ secrets.VPS_PORT }}
24+ script : |
25+ echo ">>> Navigating to project directory"
26+ cd ${{ secrets.VPS_PROJECT_PATH }}
27+
28+ echo ">>> Pulling latest changes from main"
29+ git pull origin main
30+
31+ echo ">>> Stopping running containers"
32+ docker compose down
33+
34+ echo ">>> Rebuilding and starting containers"
35+ docker compose up -d --build
36+
37+ echo ">>> Cleaning up unused Docker resources"
38+ docker image prune -f
39+
40+ echo ">>> Deployment complete!"
You can’t perform that action at this time.
0 commit comments