senti-beta / .github /workflows /deploy.yml
joseph njoroge kariuki
Deploy Senti AI to Hugging Face Spaces
021e065
name: Deploy Senti AI to Production
on:
push:
branches: [main]
jobs:
deploy:
name: Deploy to GCP VM
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Deploy via SSH to GCP
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.GCP_SSH_IP }}
username: ${{ secrets.GCP_SSH_USER }}
key: ${{ secrets.GCP_SSH_KEY }}
port: 22
script: |
echo "==== STARTING DEPLOYMENT ===="
cd ~/senti_ai
echo "1. Pulling latest codebase..."
git pull origin main
echo "2. Rebuilding frontend assets..."
cd frontend
npm ci
npm run build
cd ..
echo "3. Restarting Docker containers..."
docker compose down
docker compose up -d --build
echo "4. Running database migrations..."
# Execute database migrations inside the running API gateway container
docker compose exec -T senti-gateway python senti/scripts/migrate.py
echo "5. Verifying backend status..."
curl -f http://localhost:8000/health || exit 1
echo "==== DEPLOYMENT COMPLETED SUCCESSFULLY ===="