name: Deploy Flowstate to VPS on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - name: Trigger Build & Deploy via SSH uses: https://github.com/appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.VPS_HOST }} username: ${{ secrets.VPS_USER }} key: ${{ secrets.VPS_SSH_KEY }} port: ${{ secrets.VPS_PORT }} script_stop: true script: | echo "Starting deployment..." cd /opt/containers/projects/flowstate echo "Pulling latest code..." git pull origin main echo "Applying DB migrations..." docker compose exec -T flowstate-studio npx drizzle-kit push --config=drizzle.config.ts echo "Rebuilding Docker containers..." docker compose up -d --build echo "Cleaning up unused Docker images..." docker image prune -f echo "Deployment completed successfully." - name: Send Telegram notification on failure if: failure() run: | curl -s -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \ -d chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \ -d text="❌ Deployment Failed! Repository: $GITHUB_REPOSITORY (Commit: $GITHUB_SHA)"