oneOS/push.sh
2026-04-02 06:54:07 +00:00

57 lines
1.8 KiB
Bash
Raw Permalink 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
# ─────────────────────────────────────────────────────────────────
# one.OS — Push Script
# Ausführen: bash push.sh
# Committet alle Änderungen und pusht zu Gitea
# ─────────────────────────────────────────────────────────────────
set -e
DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$DIR"
echo ""
echo " ┌─────────────────────────────────────────┐"
echo " │ one.OS — Push to Gitea │"
echo " └─────────────────────────────────────────┘"
echo ""
# Prüfen ob git initialisiert ist
if [ ! -d ".git" ]; then
echo "❌ Kein git Repository gefunden."
echo " Bitte erst 'bash git-setup.sh' ausführen."
exit 1
fi
# Neueste Version automatisch als index.html setzen
LATEST=$(ls "$DIR"/one.OS_local_v*.html 2>/dev/null | sort -V | tail -n 1)
if [ -n "$LATEST" ]; then
cp "$LATEST" "$DIR/one_os_webapp/static/index.html"
VERSION=$(basename "$LATEST" .html | sed 's/one.OS_local_//')
echo " ✅ Frontend: $(basename $LATEST) → static/index.html"
else
VERSION="unbekannt"
fi
# Änderungen prüfen
if git diff --quiet && git diff --staged --quiet; then
echo " Keine Änderungen seit letztem Push."
exit 0
fi
# Commit-Nachricht mit Datum + Version
DATE=$(date "+%Y-%m-%d %H:%M")
MSG="${VERSION}${DATE}"
# Stagen und committen
git add .
git commit -m "$MSG"
# Pushen
echo ""
echo " Pushe zu Gitea..."
git push origin main
echo ""
echo " ✅ Push erfolgreich: $MSG"
echo ""