Skip to content

Deploy

Deploy #53

Workflow file for this run

name: Deploy
on:
workflow_run:
workflows: ["CI"]
types:
- completed
branches: [main]
workflow_dispatch:
jobs:
deploy:
name: Deploy to Server
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
environment:
name: production
url: https://${{ vars.DOMAIN }}
steps:
- name: Deploy to server via SSH
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
port: ${{ secrets.DEPLOY_PORT || 22 }}
script: |
set -e
# Navigate to application directory
cd /opt/vicinae/backend
# Pull latest changes
git pull origin main
# Install dependencies
bun install --frozen-lockfile
# Generate Prisma client
bun prisma generate
# Run migrations
bun run prisma-deploy
sudo systemctl restart vicinae
# Wait for service to be healthy
echo "Waiting for service to start..."
sleep 5
# Verify both the process and HTTP server.
systemctl is-active --quiet vicinae
curl --fail --silent --show-error http://127.0.0.1:3000/ >/dev/null
echo "Deployment completed successfully!"