name: Deploy to OCI (Ampere64)

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: self-hosted
    steps:
      - name: executing remote ssh commands using password
        uses: https://github.com/appleboy/ssh-action@master
        with:
          host: 129.146.116.218
          username: ubuntu
          key: ${{ secrets.SSH_PRIVATE_KEY }}
          port: 22
          script: |
            echo "🚀 Iniciando Deploy em CarneiroTech (OCI)"
            cd /home/ubuntu/apps/carneirotech
            
            echo "📥 Atualizando código fonte..."
            git pull origin main
            
            echo "🛠️ Executando script de deploy..."
            chmod +x deploy.sh
            ./deploy.sh
            
            echo "✨ Deploy finalizado com sucesso!"
