diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9a12c81 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.venv/ +__pycache__/ +*.py[cod] +*.egg-info/ +.git/ +.github/ +test_*/ +.DS_Store diff --git a/cron_update.sh b/cron_update.sh new file mode 100644 index 0000000..a0b5067 --- /dev/null +++ b/cron_update.sh @@ -0,0 +1,49 @@ +#!/bin/bash +set -euo pipefail + +# ───────────────────────────────────────────── +# cron_update.sh — run daily via cron +# ───────────────────────────────────────────── +# 1. Generate RSS feeds +# 2. Commit & push updated feeds to Gitea +# +# Designed for Hermes cron or system cron. +# ───────────────────────────────────────────── + +REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$REPO_DIR" + +# Setup Python +PYTHON=$(command -v python3 || command -v python) + +# Try venv first, fallback to system python +if [[ -f .venv/bin/python ]]; then + PYTHON=".venv/bin/python" +fi + +# Verify deps installed +echo "[cron] Using: $PYTHON ($($PYTHON --version))" + +# Generate feeds (save in repo root — Gitea raw URL serves directly) +echo "[cron] Generating RSS feeds..." +$PYTHON run.py --output-dir "$REPO_DIR" + +# Git commit & push if feed files changed +cd "$REPO_DIR" +CHANGED=false +for f in feed.xml feed_weekly.xml feed_monthly.xml; do + if [[ -f "$f" ]]; then + git add "$f" && CHANGED=true + fi +done + +if $CHANGED && ! git diff --cached --quiet; then + echo "[cron] Changes detected — committing and pushing..." + git commit -m "bot: update RSS feeds $(date '+%Y-%m-%d')" + git push origin main + echo "[cron] ✅ Pushed updated feeds to Gitea." +else + echo "[cron] No changes to feeds." +fi + +echo "[cron] Done."