Skip to content

sitemaps confiurations #37

sitemaps confiurations

sitemaps confiurations #37

Workflow file for this run

name: Deploy to EC2
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Add SSH key
uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Deploy to EC2
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
set -e
cd ~/github_management/RB
echo "Pulling latest code..."
git fetch origin main
git reset --hard origin/main
echo "Activating virtual environment..."
source venv/bin/activate
echo "Installing dependencies..."
pip install -r requirements.txt
echo "Running migrations..."
python manage.py migrate --noinput
echo "Restarting celery..."
sudo systemctl restart celery
echo "Restarting Gunicorn..."
sudo systemctl restart gunicorn
echo "✅ Deployment successful!"
EOF