chore: add dockerignore, cron script, update feeds
This commit is contained in:
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
.venv/
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*.egg-info/
|
||||||
|
.git/
|
||||||
|
.github/
|
||||||
|
test_*/
|
||||||
|
.DS_Store
|
||||||
49
cron_update.sh
Normal file
49
cron_update.sh
Normal file
@@ -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."
|
||||||
Reference in New Issue
Block a user