Skip to content

Deploy to EC2

Deploy to EC2 #8

Workflow file for this run

name: Deploy to EC2
on:
workflow_run:
workflows: ["CI/CD Pipeline"]
types:
- completed
branches: [main]
jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Deploy to EC2
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd /home/ubuntu/KBILabs
git pull origin main
pip install -r requirements.txt
sudo systemctl restart kbi-api
sleep 5
sudo systemctl status kbi-api
echo "✅ Deployment complete!"