scripts: add push_brief_to_gitea.sh for daily brief auto-push
This commit is contained in:
24
scripts/push_brief_to_gitea.sh
Executable file
24
scripts/push_brief_to_gitea.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# push_brief_to_gitea.sh
|
||||||
|
# 日报生成后推送至 Gitea
|
||||||
|
# 由 daily_brief.py 在生成日报后调用,或 cron 单独执行
|
||||||
|
# 用法:bash scripts/push_brief_to_gitea.sh [日期 YYYY-MM-DD]
|
||||||
|
|
||||||
|
BRIEF_DATE="${1:-$(date +%Y-%m-%d)}"
|
||||||
|
BRIEF_FILE="/home/ubuntu/freqtrade/user_data/daily_briefs/${BRIEF_DATE}.txt"
|
||||||
|
REPO_DIR="/home/ubuntu/beast-trader"
|
||||||
|
DEST_DIR="${REPO_DIR}/daily_briefs/$(echo ${BRIEF_DATE} | cut -d- -f1)"
|
||||||
|
|
||||||
|
mkdir -p "${DEST_DIR}"
|
||||||
|
|
||||||
|
if [ -f "${BRIEF_FILE}" ]; then
|
||||||
|
cp "${BRIEF_FILE}" "${DEST_DIR}/${BRIEF_DATE}.txt"
|
||||||
|
cd "${REPO_DIR}"
|
||||||
|
git add "daily_briefs/"
|
||||||
|
git commit -m "brief: auto push ${BRIEF_DATE}" --allow-empty
|
||||||
|
git push
|
||||||
|
echo "Brief ${BRIEF_DATE} pushed to Gitea"
|
||||||
|
else
|
||||||
|
echo "Brief file not found: ${BRIEF_FILE}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user