Skip to content

Commit bb11e8c

Browse files
committed
ci: add new deployment workflow for Discord bot to streamline VPS updates
1 parent 8b3a7dc commit bb11e8c

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build, Test and Deploy Discord Bot to VPS but shorter
2+
3+
on:
4+
workflow_dispatch: # Allow manual deployment
5+
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: Deploy to VPS
15+
uses: appleboy/[email protected]
16+
with:
17+
host: ${{ secrets.VPS_HOST }}
18+
username: ${{ secrets.VPS_USER }}
19+
key: ${{ secrets.VPS_SSH_KEY }}
20+
script: |
21+
cd /home/${{ secrets.VPS_USER }}/webdev-bot
22+
23+
# Stash any local changes
24+
git stash push -m "Auto-deploy $(date)" 2>/dev/null || true
25+
26+
# Pull latest changes
27+
git checkout main
28+
git pull origin main
29+
30+
# Stop any existing containers
31+
docker-compose down || true
32+
33+
# Build and start production container with profile
34+
docker-compose --profile prod up -d --build
35+
36+
# Check status
37+
echo "Deployment completed. Container status:"
38+
docker-compose ps

0 commit comments

Comments
 (0)