Deploy #38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.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 service is running | |
| sudo systemctl is-active --quiet vicinae && echo "✅ Service is running" || echo "❌ Service failed to start" | |
| echo "Deployment completed successfully!" |