Skip to content

Build, Test and Deploy Discord Bot to VPS #11

Build, Test and Deploy Discord Bot to VPS

Build, Test and Deploy Discord Bot to VPS #11

Workflow file for this run

name: Build, Test and Deploy Discord Bot to VPS but shorter
on:
workflow_dispatch: # Allow manual deployment
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to VPS
uses: appleboy/[email protected]
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
script: |
cd /home/${{ secrets.VPS_USER }}/webdev-bot
# Stash any local changes
git stash push -m "Auto-deploy $(date)" 2>/dev/null || true
# Pull latest changes
git checkout main
git pull origin main
# Stop any existing containers
docker-compose down || true
# Build and start production container with profile
docker-compose --profile prod up -d --build
# Check status
echo "Deployment completed. Container status:"
docker-compose ps