Add CI/CD support for automated tunnel deployment
Some checks failed
deploy-tunnel / deploy (push) Failing after 1s
Some checks failed
deploy-tunnel / deploy (push) Failing after 1s
- setup-ci.sh: Script no interactivo que verifica archivos de config - Workflow actualizado para ejecutar setup-ci.sh antes del deploy - Los archivos credentials.json y .env persisten en el workspace del runner - Solo requiere setup.sh manual la primera vez en el servidor - Documentación actualizada con instrucciones para CI/CD
This commit is contained in:
50
setup-ci.sh
Executable file
50
setup-ci.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
# Setup no interactivo para CI/CD (Gitea Actions)
|
||||
# Usa Cloudflare API Token en vez de login interactivo
|
||||
|
||||
set -e
|
||||
|
||||
TUNNEL_NAME="nucleorio-tunnel"
|
||||
DOMAIN="nucleoriofrio.com"
|
||||
ACCOUNT_ID="${CLOUDFLARE_ACCOUNT_ID}"
|
||||
API_TOKEN="${CLOUDFLARE_API_TOKEN}"
|
||||
|
||||
echo "🤖 Cloudflare Tunnel CI Setup"
|
||||
echo "=============================="
|
||||
echo ""
|
||||
|
||||
# Verificar variables de entorno
|
||||
if [ -z "$ACCOUNT_ID" ]; then
|
||||
echo "❌ CLOUDFLARE_ACCOUNT_ID no está configurado"
|
||||
echo " Configúralo en Gitea: Settings > Secrets"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$API_TOKEN" ]; then
|
||||
echo "❌ CLOUDFLARE_API_TOKEN no está configurado"
|
||||
echo " Configúralo en Gitea: Settings > Secrets"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verificar si ya existen los archivos
|
||||
if [ -f "credentials.json" ] && [ -f ".env" ]; then
|
||||
echo "✓ credentials.json y .env ya existen"
|
||||
TUNNEL_ID=$(jq -r '.TunnelID' credentials.json 2>/dev/null || echo "")
|
||||
|
||||
if [ -n "$TUNNEL_ID" ]; then
|
||||
echo "✓ TUNNEL_ID: $TUNNEL_ID"
|
||||
echo "✓ Setup ya está completo, no se requiere acción"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "⚠️ Archivos de configuración no encontrados"
|
||||
echo ""
|
||||
echo "Para CI/CD automatizado necesitas:"
|
||||
echo "1. Ejecutar ./setup.sh manualmente UNA VEZ en el servidor"
|
||||
echo "2. Esto genera credentials.json y .env"
|
||||
echo "3. Estos archivos persisten entre deploys del runner"
|
||||
echo ""
|
||||
echo "El workflow automáticamente los usará en futuros deploys."
|
||||
echo ""
|
||||
exit 1
|
||||
Reference in New Issue
Block a user