Auto-sync Wed 31 Dec 18:45:09 CET 2025

This commit is contained in:
Lionel
2025-12-31 18:45:09 +01:00
parent bb4c8dd59c
commit 54aad6a279
2 changed files with 14 additions and 8 deletions

View File

@@ -6,3 +6,14 @@ Tue 23 Dec 03:25:01 CET 2025: Pulled new changes
Tue 23 Dec 03:25:01 CET 2025: Triggered MkDocs rebuild
: Pushed local changes to Gitea
: Triggered MkDocs rebuild
date: extra operand %H:%M
Try 'date --help' for more information.
[main bb4c8dd] Auto-sync:
1 file changed, 2 insertions(+)
date: extra operand %H:%M:%S
Try 'date --help' for more information.
: Pushed local changes to Gitea
mkdocs
date: extra operand %H:%M:%S
Try 'date --help' for more information.
: Triggered MkDocs rebuild

11
sync.sh
View File

@@ -10,7 +10,7 @@ BRANCH="main"
cd "$DOCS_DIR" || exit 1
log() {
echo "$(date +%Y-%m-%d %H:%M:%S): $1" >> "$LOG_FILE"
echo "$(date): $1" >> "$LOG_FILE"
}
# Fetch latest from remote
@@ -21,10 +21,9 @@ REMOTE_REV=$(git rev-parse "$REMOTE/$BRANCH" 2>/dev/null)
case "${1:-auto}" in
push)
# Push local changes to Gitea
git add -A
if ! git diff --cached --quiet; then
git commit -m "Auto-sync: $(date +%Y-%m-%d %H:%M)"
git commit -m "Auto-sync $(date)"
git push "$REMOTE" "$BRANCH" --quiet
log "Pushed local changes to Gitea"
else
@@ -32,7 +31,6 @@ case "${1:-auto}" in
fi
;;
pull)
# Pull from Gitea
if [ "$LOCAL" != "$REMOTE_REV" ]; then
git pull "$REMOTE" "$BRANCH" --quiet
log "Pulled changes from Gitea"
@@ -43,8 +41,6 @@ case "${1:-auto}" in
fi
;;
auto)
# Auto: pull first, then push local changes
# Check for remote changes
if [ "$LOCAL" != "$REMOTE_REV" ]; then
git stash --quiet 2>/dev/null
git pull "$REMOTE" "$BRANCH" --quiet
@@ -52,10 +48,9 @@ case "${1:-auto}" in
log "Pulled changes from Gitea"
fi
# Check for local changes
git add -A
if ! git diff --cached --quiet; then
git commit -m "Auto-sync: $(date +%Y-%m-%d %H:%M)"
git commit -m "Auto-sync $(date)"
git push "$REMOTE" "$BRANCH" --quiet
log "Pushed local changes to Gitea"
docker kill --signal=SIGHUP mkdocs 2>/dev/null || docker restart mkdocs