Files

44 lines
1.7 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# ---------------------------------------------------------
# STEELXR: SCRIPT DE ATUALIZAÇÃO E DEPLOY AUTOMÁTICO
# ---------------------------------------------------------
CYAN='\033[0;36m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "\n${CYAN}🚀 Iniciando Ciclo Automático SteelXR...${NC}"
# 1. Sincronização com Repositório Git (se existir)
if [ -d .git ]; then
echo -e "${YELLOW}📝 Sincronizando código com Git...${NC}"
git add .
if git diff-index --quiet HEAD --; then
echo -e "${GREEN}✨ Código local já está sincronizado.${NC}"
else
TIMESTAMP=$(date +"%d/%m/%Y %H:%M:%S")
echo -e "${CYAN}📤 Gravando alterações (Auto-update $TIMESTAMP)...${NC}"
git commit -m "🚀 Auto-deploy: melhoria no snap e medição AR em $TIMESTAMP"
if git remote | grep -q 'origin'; then
echo -e "${CYAN}📤 Enviando para o repositório remoto (Gitea)...${NC}"
git push origin main
fi
fi
else
echo -e "${YELLOW}️ Diretório não é um repositório Git. Pulando sincronização Git.${NC}"
fi
# 2. Acionar deploy diretamente no Coolify
echo -e "${YELLOW}⚙️ Acionando deploy direto no Coolify...${NC}"
DEPLOY_RESULT=$(docker exec coolify php artisan tinker --execute="print_r(queue_application_deployment(application: App\Models\Application::find(38), deployment_uuid: new Visus\Cuid2\Cuid2, force_rebuild: false));" 2>&1)
if echo "$DEPLOY_RESULT" | grep -q "queued"; then
echo -e "${GREEN}✅ Deploy enfileirado com sucesso no Coolify!${NC}"
else
echo -e "${RED}❌ Falha ao enfileirar deploy no Coolify. Detalhes: $DEPLOY_RESULT${NC}"
fi
echo -e "${GREEN}🏁 Ciclo concluído com sucesso.${NC}\n"