150 lines
4.4 KiB
Bash
Executable File
150 lines
4.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# =============================================================================
|
|
# Git Upload Helper Script
|
|
# LibreBooking n8n Node v1.2.0
|
|
# =============================================================================
|
|
|
|
set -e
|
|
|
|
echo "🚀 Git Upload Vorbereitung"
|
|
echo "========================="
|
|
echo ""
|
|
|
|
# Prüfe ob Git installiert ist
|
|
if ! command -v git &> /dev/null; then
|
|
echo "❌ Git ist nicht installiert!"
|
|
echo " Installiere mit: sudo apt install git"
|
|
exit 1
|
|
fi
|
|
|
|
# Prüfe ob Git Repository existiert
|
|
if [ ! -d .git ]; then
|
|
echo "❌ Kein Git Repository gefunden!"
|
|
echo " Möchtest du eines initialisieren? (y/n)"
|
|
read -p " > " init_git
|
|
if [[ $init_git =~ ^[Yy]$ ]]; then
|
|
git init
|
|
echo "✅ Git Repository initialisiert"
|
|
else
|
|
echo "Abgebrochen."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Prüfe ob Remote existiert
|
|
echo ""
|
|
echo "📡 Remote Konfiguration:"
|
|
if git remote | grep -q origin; then
|
|
current_remote=$(git remote get-url origin 2>/dev/null || echo "nicht konfiguriert")
|
|
echo " Aktueller Remote: $current_remote"
|
|
echo ""
|
|
read -p " Möchtest du den Remote ändern? (y/n) " change_remote
|
|
if [[ $change_remote =~ ^[Yy]$ ]]; then
|
|
git remote remove origin
|
|
echo " Remote entfernt."
|
|
fi
|
|
fi
|
|
|
|
if ! git remote | grep -q origin; then
|
|
echo ""
|
|
echo "📝 Bitte Git Remote URL eingeben:"
|
|
echo " Beispiele:"
|
|
echo " - https://github.com/USERNAME/n8n-nodes-librebooking.git"
|
|
echo " - https://gitlab.com/USERNAME/n8n-nodes-librebooking.git"
|
|
echo " - git@github.com:USERNAME/n8n-nodes-librebooking.git"
|
|
echo ""
|
|
read -p " URL: " remote_url
|
|
if [ -z "$remote_url" ]; then
|
|
echo "❌ Keine URL eingegeben. Abgebrochen."
|
|
exit 1
|
|
fi
|
|
git remote add origin "$remote_url"
|
|
echo "✅ Remote hinzugefügt: $remote_url"
|
|
fi
|
|
|
|
# Status anzeigen
|
|
echo ""
|
|
echo "📊 Git Status:"
|
|
echo "─────────────────────────────────────"
|
|
git status --short
|
|
echo "─────────────────────────────────────"
|
|
|
|
# Anzahl der Änderungen
|
|
changed_files=$(git status --porcelain | wc -l)
|
|
if [ "$changed_files" -gt 0 ]; then
|
|
echo " $changed_files Datei(en) mit Änderungen"
|
|
else
|
|
echo " Keine uncommitteten Änderungen"
|
|
fi
|
|
|
|
# Branch Information
|
|
echo ""
|
|
echo "🌿 Branch: $(git branch --show-current 2>/dev/null || echo 'kein Branch')"
|
|
|
|
# Bestätigung für Commit
|
|
if [ "$changed_files" -gt 0 ]; then
|
|
echo ""
|
|
read -p "Möchtest du alle Änderungen committen? (y/n) " -n 1 -r
|
|
echo
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
git add .
|
|
echo ""
|
|
echo "📝 Commit Message (Enter für Standard):"
|
|
read -p " > " commit_msg
|
|
if [ -z "$commit_msg" ]; then
|
|
commit_msg="feat: LibreBooking n8n Node v1.2.0"
|
|
fi
|
|
git commit -m "$commit_msg"
|
|
echo "✅ Commit erstellt"
|
|
fi
|
|
fi
|
|
|
|
# Push
|
|
echo ""
|
|
read -p "Möchtest du zum Remote pushen? (y/n) " -n 1 -r
|
|
echo
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
echo ""
|
|
echo "🚀 Pushe zum Remote..."
|
|
|
|
# Branch auf main umbenennen falls nötig
|
|
current_branch=$(git branch --show-current)
|
|
if [ "$current_branch" != "main" ] && [ "$current_branch" != "master" ]; then
|
|
read -p " Branch '$current_branch' zu 'main' umbenennen? (y/n) " rename_branch
|
|
if [[ $rename_branch =~ ^[Yy]$ ]]; then
|
|
git branch -M main
|
|
echo " ✅ Branch umbenannt zu 'main'"
|
|
fi
|
|
fi
|
|
|
|
git push -u origin $(git branch --show-current)
|
|
echo "✅ Code gepusht!"
|
|
|
|
# Tags pushen
|
|
if git tag | grep -q "."; then
|
|
echo ""
|
|
read -p "Möchtest du auch alle Tags pushen? (y/n) " -n 1 -r
|
|
echo
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
git push origin --tags
|
|
echo "✅ Tags gepusht!"
|
|
fi
|
|
fi
|
|
|
|
echo ""
|
|
echo "═══════════════════════════════════════"
|
|
echo "✅ Erfolgreich hochgeladen!"
|
|
echo "═══════════════════════════════════════"
|
|
echo ""
|
|
echo "📋 Nächste Schritte:"
|
|
echo " 1. Repository auf GitHub/GitLab prüfen"
|
|
echo " 2. README.md URLs anpassen"
|
|
echo " 3. Release erstellen (optional)"
|
|
else
|
|
echo "❌ Push abgebrochen"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Fertig! 🎉"
|