VigilanzaTurni/push-gitlab.sh
marco370 acc1939f44 Add automated deployment with versioning and database backup
Introduces a new deployment script (push-gitlab.sh) and documentation (GITLAB-DEPLOY.md) to automate pushing code to GitLab. The system supports semantic versioning (patch, minor, major) for releases and automatically backs up the database before each deployment. It also includes instructions for configuring GitLab credentials via a `git.env` file.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 42d8028a-fa71-4ec2-938c-e43eedf7df01
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/6d543d2c-20b9-4ea6-93fe-70fe9b1d9f80/42d8028a-fa71-4ec2-938c-e43eedf7df01/Z1LDqzu
2025-10-17 06:38:57 +00:00

81 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# =============================================================================
# VigilanzaTurni - Quick Push to GitLab
# =============================================================================
# Script semplificato per deployment rapido
# =============================================================================
# Colori
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m'
echo -e "${BLUE}"
echo "╔═══════════════════════════════════════════════╗"
echo "║ VigilanzaTurni - GitLab Deployment ║"
echo "╔═══════════════════════════════════════════════╝"
echo -e "${NC}"
# Mostra uso
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
echo "Uso:"
echo ""
echo " ./push-gitlab.sh → Patch version (1.0.0 → 1.0.1)"
echo " ./push-gitlab.sh minor → Minor version (1.0.5 → 1.1.0)"
echo " ./push-gitlab.sh major → Major version (1.1.5 → 2.0.0)"
echo ""
echo "Esempi:"
echo ""
echo " ./push-gitlab.sh # Fix bug, piccole modifiche"
echo " ./push-gitlab.sh minor # Nuove funzionalità"
echo " ./push-gitlab.sh major # Breaking changes"
echo ""
exit 0
fi
# Determina tipo incremento
INCREMENT_TYPE=${1:-patch}
case $INCREMENT_TYPE in
patch)
echo -e "${GREEN}📦 Deploy PATCH${NC} - Bug fix, piccole modifiche"
;;
minor)
echo -e "${YELLOW}🆕 Deploy MINOR${NC} - Nuove funzionalità"
;;
major)
echo -e "${BLUE}🚀 Deploy MAJOR${NC} - Breaking changes"
;;
*)
echo -e "❌ Tipo non valido: $INCREMENT_TYPE"
echo "Usa: patch, minor, o major"
exit 1
;;
esac
echo ""
# Verifica git.env
if [ ! -f "git.env" ]; then
echo "⚠️ git.env non trovato!"
echo ""
echo "Crea il file git.env con queste informazioni:"
echo ""
echo "GITLAB_USER=tuo-username"
echo "GITLAB_TOKEN=tuo-token-personale"
echo "GITLAB_REPO=https://gitlab.com/tuo-username/vigilanzaturni.git"
echo "GITLAB_BRANCH=main"
echo ""
echo "Ottieni il token su: https://gitlab.com/-/profile/personal_access_tokens"
echo "Permessi richiesti: api, read_repository, write_repository"
echo ""
exit 1
fi
# Esegui deployment
./deploy-to-gitlab.sh "$INCREMENT_TYPE"
exit $?