#!/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! πŸŽ‰"