feat: Phase 1 添加 GHA 定时、run-daily.sh 与 Docker 部署

让早报可在无本地服务器环境下定时生成并推送企微,补齐 Linux/CI 入口。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-03 14:51:11 +08:00
parent 8075ab78e8
commit 728bd1b9d1
7 changed files with 275 additions and 0 deletions

View File

@@ -36,10 +36,53 @@
python -m daily push output\2026-07-03.wecom.md # 只推送
```
Linux / macOS / CI 等价脚本:
```bash
chmod +x run-daily.sh
./run-daily.sh # 生成 + 推送
./run-daily.sh --skip-push # 只生成
./run-daily.sh --force # 忽略 30 分钟内重复运行锁
```
**前置条件**Python 3.10+、企业微信群机器人 webhook。无需 Bot API 凭证。
---
## 部署GitHub Actions / Docker
### GitHub Actions零服务器定时推送
仓库已包含 [`.github/workflows/daily.yml`](.github/workflows/daily.yml),默认每天 **08:30北京时间** 生成并推送。
1. Fork 或启用本仓库的 Actions
2. **Settings → Secrets and variables → Actions** 添加 Secrets
| Secret | 必需 | 说明 |
|--------|------|------|
| `WECOM_WEBHOOK_KEY` | 是 | 企微群机器人 webhook key |
| `GH_PAT` | 否 | 个人 GitHub PAT提高 API 限额;不设则用 Actions 内置 token |
| `CURSOR_API_KEY` | 否 | Agent 模式Cursor SDK |
| `DAILY_LLM_API_KEY` | 否 | Agent / 编辑层OpenAI 兼容 API |
3. 可选 **Variables**(不设则用代码默认值):`DAILY_REPORT_MODE`、`DAILY_LLM_MODEL`、`DAILY_AI_NEWS` 等
4. **Actions → daily → Run workflow** 可手动触发;勾选 *Skip WeCom push* 则只生成不上报
运行产物可在 workflow 的 **Artifacts** 中下载(`.md` / `.json`,保留 14 天)。
### Docker
```bash
cp .env.example .env # 填入 WECOM_WEBHOOK_KEY 等
docker compose build
docker compose run --rm daily # 生成 + 推送
docker compose run --rm daily --skip-push # 只生成
```
`output/`、`.cache/`、`logs/` 挂载到宿主机,与本地 `run-daily.ps1` 行为一致。
---
## Agent 模式(推荐)
默认 `classic` 是分区榜单模板;**推荐 Agent 模式**——导语 + 今日信号 + 精选新闻 + 榜单,全中文叙述。