Deploy to Staging - Skill
Descripción
Automatiza el despliegue seguro a staging en IONOS. Incluye pre-checks, rollback automático y validación.
Cuándo usar
code
"Deploy a staging ahora" "¿Puedes desplegar cambios a staging?" "Necesito ver los cambios en staging"
Flujo de Ejecución
Pre-Checks (Antes de desplegar)
bash
# 1. Verificar que rama esté limpia git status --porcelain # 2. Ejecutar tests críticos pytest tests/ -v -k "not slow" --tb=short # 3. Build verificación npm run build 2>/dev/null || python -m compileall apps/ # 4. Verificar secrets no expuestos git diff HEAD~1 | grep -E "(password|token|key|secret)" && echo "❌ Secrets detectados!" || echo "✅ Sin secrets"
Deployment (IONOS staging)
bash
# 1. Crear rama temporal
git checkout -b staging/$(date +%Y%m%d-%H%M%S)
# 2. Push a staging
git push origin staging
# 3. Trigger GitHub Actions (esperar webhook automático)
# Se ejecuta .github/workflows/deploy-staging.yml
# 4. Monitoreo
# Verificar en GitHub Actions dashboard
# URL: https://github.com/{owner}/runart-foundry/actions
Post-Deployment
bash
# 1. Ejecutar tests de integración en staging # (definir en .github/workflows/test-staging.yml) # 2. Verificar health checks curl -s https://staging.runartfoundry.com/health | jq . # 3. Verificar logs de error # Acceder a: https://ionos.com/dashboard → staging logs # 4. Rollback si es necesario # Ejecutar: .github/workflows/rollback-staging.yml
Decisiones Críticas
Cuándo esto FALLA:
- •❌ Tests no pasan → Mostrar errores específicos
- •❌ Secrets detectados → STOP, no continuar
- •❌ Staging health check falla → Rollback automático
- •❌ Base de datos no valida → STOP
Cuándo es seguro proceder:
- •✅ Todos tests pasan
- •✅ Sin secrets expuestos
- •✅ Health checks OK
- •✅ Staging accesible
Rollback Automático
Si algo falla en staging:
bash
# Volver a última versión estable git revert HEAD git push origin staging # Esperar webhook → automático redeploy
Documentación
Métricas
- •Tiempo típico: 5-10 minutos
- •Éxito rate: 95%+ (con estos pre-checks)
- •Rollback tiempo: <2 minutos