Files
2026-05-15 08:44:32 -03:00

76 lines
1.6 KiB
Bash
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
# Script de deploy automático para Vercel
# Uso: ./deploy.sh [mensagem do commit]
echo "========================================"
echo " TrackSteel - Deploy Automático"
echo "========================================"
echo
# Cores para output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Função para exibir erro e sair
error_exit() {
echo -e "${RED}Erro: $1${NC}"
exit 1
}
# Função para exibir sucesso
success_msg() {
echo -e "${GREEN}$1${NC}"
}
# Função para exibir info
info_msg() {
echo -e "${BLUE} $1${NC}"
}
# Função para exibir aviso
warning_msg() {
echo -e "${YELLOW}$1${NC}"
}
# Verifica se o Vercel CLI está instalado
if ! command -v vercel &> /dev/null; then
warning_msg "Vercel CLI não encontrado. Instalando..."
npm install -g vercel
if [ $? -ne 0 ]; then
error_exit "Falha ao instalar Vercel CLI"
fi
success_msg "Vercel CLI instalado com sucesso"
fi
# Executa o script de sync primeiro
info_msg "Sincronizando com GitHub..."
./sync.sh "$1"
if [ $? -ne 0 ]; then
error_exit "Falha na sincronização com GitHub"
fi
echo
info_msg "Iniciando build de produção..."
npm run build
if [ $? -ne 0 ]; then
error_exit "Falha no build de produção"
fi
echo
info_msg "Fazendo deploy no Vercel..."
vercel --prod
if [ $? -ne 0 ]; then
error_exit "Falha no deploy do Vercel"
fi
echo
success_msg "Deploy concluído com sucesso!"
success_msg "Código sincronizado: https://github.com/Reifonas/WebsiteTS.git"
success_msg "Site disponível no Vercel"
echo
info_msg "Para ver o status do deploy:"
echo "vercel ls"
echo