4NK_env/scripts/push-to-remote.sh
LeCoffre Deployment d8d4530d2d auto_clea
2025-09-25 21:26:28 +00:00

93 lines
2.4 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
set -euo pipefail
echo "🚀 PUSH DU DÉPÔT 4NK_ENV VERS GIT.4NKWEB.COM"
echo "============================================="
# Fonction de logging
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
}
# Configuration
BRANCH="ext"
GIT_REMOTE="git@git.4nkweb.com:4nk/4NK_env.git"
log "📋 Configuration:"
echo " Branche: $BRANCH"
echo " Remote: $GIT_REMOTE"
echo ""
# Vérifier qu'on est dans le bon répertoire
if [ ! -d ".git" ]; then
log "❌ Erreur: Vous devez être dans le répertoire 4NK_env"
exit 1
fi
# Vérifier la configuration SSH
log "🔧 Vérification de la configuration Git SSH..."
if ! ssh -T git@git.4nkweb.com 2>&1 | grep -q "successfully authenticated"; then
echo "❌ Erreur: Clé SSH non configurée pour git.4nkweb.com"
echo " Vérifiez votre configuration SSH et vos clés"
exit 1
fi
log "✅ Clé SSH configurée"
# Vérifier le remote
current_remote=$(git remote get-url origin 2>/dev/null || echo "Non configuré")
log "🔗 Remote actuel: $current_remote"
if [ "$current_remote" != "$GIT_REMOTE" ]; then
log "🔧 Configuration du remote origin..."
git remote set-url origin "$GIT_REMOTE"
log "✅ Remote origin configuré"
fi
# Vérifier le statut
log "📊 Statut du dépôt:"
git status --short
# Ajouter tous les fichiers
log "📁 Ajout des fichiers..."
git add .
# Vérifier s'il y a des changements
if git diff --staged --quiet; then
log " Aucun changement à committer"
else
log "💾 Commit des modifications..."
git commit -m "ci: docker_tag=ext
Update 4NK Environment
- Scripts de déploiement et gestion
- Configuration autonome LeCoffre Node
- Documentation complète
- Support redirections IdNot"
log "✅ Commit créé"
fi
# Pousser vers le dépôt distant
log "🚀 Push vers le dépôt distant..."
if git push origin "$BRANCH"; then
log "✅ Push réussi vers git.4nkweb.com"
log "🔗 Dépôt disponible: $GIT_REMOTE"
else
log "❌ Échec du push"
log "💡 Vérifiez que le dépôt '4NK_env' existe sur git.4nkweb.com"
log " et que vous avez les droits d'écriture"
exit 1
fi
echo ""
log "🎉 Dépôt 4NK_env poussé avec succès!"
log "📊 Résumé:"
echo " ✅ Dépôt local synchronisé"
echo " ✅ Branche '$BRANCH' poussée"
echo " ✅ Tous les fichiers inclus"
echo ""
log "🔗 URL du dépôt: $GIT_REMOTE"
log "📝 Branche: $BRANCH"