48 lines
1.4 KiB
YAML
48 lines
1.4 KiB
YAML
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()
|
|
uses: appleboy/telegram-action@master
|
|
with:
|
|
to: ${{ secrets.TELEGRAM_CHAT_ID }}
|
|
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
|
message: |
|
|
❌ Deployment Failed!
|
|
Repository: ${{ github.repository }}
|
|
Commit: ${{ github.sha }}
|
|
Workflow: ${{ github.workflow }}
|