Skip to content

Commit 9c139db

Browse files
author
NightVoyager
committed
ci: 自动发布记录切换到 record_publish.py
- auto-analyze.yml:发布步骤改调 record_publish.py 写 jsonl, 提交目标由 src/publish.md 改为 src/data/publish_history.jsonl - analyze.yml / pages.yml:刷新元数据前增加 init_db.py seed-publish
1 parent 2924fe5 commit 9c139db

3 files changed

Lines changed: 18 additions & 13 deletions

File tree

‎.github/workflows/analyze.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ jobs:
108108
echo "lines=$(wc -l < "$REPORT_PATH")" >> "$GITHUB_OUTPUT"
109109
110110
- name: Refresh site metadata (DB-backed)
111-
# 阶段 1-3:reports + tags + starred + trending 主写 DB,JSON/YAML 由 export-json dump
111+
# 阶段 1-4:reports + tags + starred + trending + publish_history 主写 DB
112+
# JSON/YAML 由 export-json dump;publish_history.jsonl 是 publish 历史的 SoR
112113
run: |
113114
python3 scripts/init_db.py init
115+
python3 scripts/init_db.py seed-publish
114116
python3 scripts/build_reports_index.py
115117
python3 scripts/extract_tags.py
116118
python3 scripts/parse_starred.py

‎.github/workflows/auto-analyze.yml‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -274,26 +274,27 @@ jobs:
274274
fi
275275
fi
276276
277-
- name: Update publish.md
277+
- name: Record publish history (jsonl)
278+
# 阶段 4:发布记录 SoR 从 publish.md 表格切换到 publish_history.jsonl
279+
# publish.md 保留为只读历史归档,不再被本步骤追加
278280
if: steps.report.outputs.path != ''
279281
env:
280282
PUBLISH_STATUS: ${{ steps.publish.outputs.publish_status }}
281283
run: |
282284
set -euo pipefail
283285
ts="$(date -u +%Y-%m-%d)"
284286
if [[ "${{ github.event.inputs.skip_publish }}" == "true" ]]; then
285-
status="仅分析"
287+
reason="仅分析"
286288
elif [[ "$PUBLISH_STATUS" == "deferred" ]]; then
287-
status="待重发"
289+
reason="待重发"
288290
else
289-
status="已入草稿"
290-
fi
291-
line="| $(basename ${{ steps.report.outputs.path }}) | 自动生成 | $ts ($status) |"
292-
if [[ -f src/publish.md ]]; then
293-
echo "$line" >> src/publish.md
294-
else
295-
printf '# 发布记录\n\n| 文件 | 标题 | 状态 |\n|---|---|---|\n%s\n' "$line" > src/publish.md
291+
reason="自动生成"
296292
fi
293+
slug="$(basename ${{ steps.report.outputs.path }} .md)"
294+
python3 scripts/record_publish.py \
295+
--slug "$slug" --state pending \
296+
--published-at "$ts" --reason "$reason" \
297+
--ci-run-id "${{ github.run_id }}"
297298
298299
- name: Commit & Push
299300
if: steps.report.outputs.path != ''
@@ -302,7 +303,7 @@ jobs:
302303
set -uo pipefail
303304
git config user.name "github-actions[bot]"
304305
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
305-
git add notes/ src/analysis_report/ src/publish.md
306+
git add notes/ src/analysis_report/ src/data/publish_history.jsonl
306307
if git diff --cached --quiet; then
307308
echo "::notice::无变更可提交"
308309
exit 0

‎.github/workflows/pages.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ jobs:
4141
run: pip install -r requirements-ci.txt
4242

4343
- name: Refresh metadata via SQLite (db.sqlite → reports.json / tags.yaml / starred.json / all_repos_deduped.json)
44-
# 阶段 1-3 已迁库:reports + tags + starred + trending 均主写 DB;JSON/YAML 由 init_db.py export-json dump
44+
# 阶段 1-4 已迁库:reports + tags + starred + trending + publish_history 全部主写 DB
45+
# JSON/YAML 由 init_db.py export-json dump;jsonl 是 publish 历史的 SoR
4546
run: |
4647
python3 scripts/init_db.py init
48+
python3 scripts/init_db.py seed-publish
4749
python3 scripts/build_reports_index.py
4850
python3 scripts/extract_tags.py
4951
python3 scripts/parse_starred.py

0 commit comments

Comments
 (0)