name: Deploy to Prod Server

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repo
        uses: actions/checkout@v3

      - name: Deploy via SSH
        uses: appleboy/ssh-action@master
        with:
          host: ${{ secrets.SERVER_HOST }}
          username: ${{ secrets.SERVER_USER }}
          key: ${{ secrets.SERVER_KEY }}
          script: |
            cd /root/kurortx
            git pull
            docker compose -f infra/docker-compose.yml down
            docker compose -f infra/docker-compose.yml up -d --build
      - name: Send Telegram notification
        run: |
          curl -s -X POST https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage \
            -d chat_id="-1002588434075" \
            -d text="✅ Пенис успешно вставлен в попу @thehaffk. Фулл по ссылке: http://212.22.86.61/ (Даже в Кыргызстане есть)."
