mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-26 02:04:37 +08:00
chore(changelog): move release changelogs out of docs
This commit is contained in:
1 parent
8564db7241
commit
2d714857ef
16 files changed
+48
-55
No files matched your search
@@ -338,8 +338,8 @@ jobs:
|
||||
echo "Current version: $CURRENT_VERSION"
|
||||
|
||||
# 按当前版本号从 changelog JSON 中提取 summary,避免补发旧版本时误用第一条日志。
|
||||
EN_SUMMARY=$(jq -r --arg version "$VERSION_NUMBER" 'map(select(.version == $version))[0].summary // "See changelog for details"' docs/public/changelogs/en.json 2>/dev/null || echo "See changelog for details")
|
||||
CN_SUMMARY=$(jq -r --arg version "$VERSION_NUMBER" 'map(select(.version == $version))[0].summary // "详见更新日志"' docs/public/changelogs/cn.json 2>/dev/null || echo "详见更新日志")
|
||||
EN_SUMMARY=$(jq -r --arg version "$VERSION_NUMBER" 'map(select(.version == $version))[0].summary // "See changelog for details"' changelogs/en.json 2>/dev/null || echo "See changelog for details")
|
||||
CN_SUMMARY=$(jq -r --arg version "$VERSION_NUMBER" 'map(select(.version == $version))[0].summary // "详见更新日志"' changelogs/cn.json 2>/dev/null || echo "详见更新日志")
|
||||
|
||||
echo "EN summary: $EN_SUMMARY"
|
||||
echo "CN summary: $CN_SUMMARY"
|
||||
@@ -356,7 +356,7 @@ jobs:
|
||||
echo ""
|
||||
echo "---"
|
||||
echo ""
|
||||
echo "Full Changelog: [English](https://github.com/ChatLab/ChatLab/blob/main/docs/public/changelogs/en.json) | [中文](https://github.com/ChatLab/ChatLab/blob/main/docs/public/changelogs/cn.json) | [日本語](https://github.com/ChatLab/ChatLab/blob/main/docs/public/changelogs/ja.json)"
|
||||
echo "Full Changelog: [English](https://github.com/ChatLab/ChatLab/blob/main/changelogs/en.json) | [中文](https://github.com/ChatLab/ChatLab/blob/main/changelogs/cn.json) | [日本語](https://github.com/ChatLab/ChatLab/blob/main/changelogs/ja.json)"
|
||||
echo ""
|
||||
echo "---"
|
||||
echo ""
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
name: Sync docs to chatlab.fun
|
||||
name: Sync changelogs to chatlab.fun
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- 'changelogs/**'
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
@@ -13,7 +14,7 @@ jobs:
|
||||
- name: Checkout ChatLab
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: docs
|
||||
sparse-checkout: changelogs
|
||||
|
||||
- name: Checkout chatlab.fun
|
||||
uses: actions/checkout@v4
|
||||
@@ -22,18 +23,10 @@ jobs:
|
||||
token: ${{ secrets.CHATLAB_FUN_TOKEN }}
|
||||
path: chatlab-fun
|
||||
|
||||
- name: Sync docs
|
||||
- name: Sync changelogs
|
||||
run: |
|
||||
rsync -av --delete \
|
||||
--exclude='.vitepress' \
|
||||
--exclude='public' \
|
||||
--exclude='README*' \
|
||||
docs/ chatlab-fun/docs/
|
||||
|
||||
- name: Sync public assets
|
||||
run: |
|
||||
rsync -av \
|
||||
docs/public/ chatlab-fun/public/
|
||||
changelogs/ chatlab-fun/public/changelogs/
|
||||
|
||||
- name: Commit and push
|
||||
id: push
|
||||
@@ -41,12 +34,12 @@ jobs:
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add docs/ public/
|
||||
git add public/changelogs/
|
||||
if git diff --cached --quiet; then
|
||||
echo "No changes to commit"
|
||||
echo "pushed=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
git commit -m "sync: update docs from ChatLab@${GITHUB_SHA::7}"
|
||||
git commit -m "sync: update changelogs from ChatLab@${GITHUB_SHA::7}"
|
||||
git push
|
||||
echo "pushed=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,16 +1,16 @@
|
||||
---
|
||||
name: generate-changelog
|
||||
description: 根据当前项目 package.json 版本与 Git 提交记录生成中文版本日志。用于用户提出"生成版本日志""生成 changelog""发布新版本并生成更新记录"等请求时,自动读取当前版本号、定位上一版本、汇总版本区间 commit,并更新 docs/public/changelogs/cn.json(新增版本、生成中文 summary、按类型归类变更)。
|
||||
description: 根据当前项目 package.json 版本与 Git 提交记录生成中文版本日志。用于用户提出"生成版本日志""生成 changelog""发布新版本并生成更新记录"等请求时,自动读取当前版本号、定位上一版本、汇总版本区间 commit,并更新 changelogs/cn.json(新增版本、生成中文 summary、按类型归类变更)。
|
||||
---
|
||||
|
||||
# generate-changelog
|
||||
|
||||
按以下流程更新 `docs/public/changelogs/cn.json`。
|
||||
按以下流程更新 `changelogs/cn.json`。
|
||||
|
||||
## 1. 读取版本与日志现状
|
||||
|
||||
1. 读取 `package.json` 中的 `version` 作为 `currentVersion`。
|
||||
2. 读取 `docs/public/changelogs/cn.json`,确认是否已存在 `currentVersion`。
|
||||
2. 读取 `changelogs/cn.json`,确认是否已存在 `currentVersion`。
|
||||
3. 若已存在:停止新增流程,改为"就地更新该版本内容"。
|
||||
4. 计算 `previousVersion`:
|
||||
- 若 `currentVersion` 已存在于 changelog:取它的下一条记录版本号。
|
||||
@@ -84,7 +84,7 @@ git show -s --format='%B' <commit>
|
||||
|
||||
## 5. 更新 JSON 文件
|
||||
|
||||
目标文件:`docs/public/changelogs/cn.json`
|
||||
目标文件:`changelogs/cn.json`
|
||||
|
||||
更新规则:
|
||||
|
||||
@@ -99,7 +99,7 @@ git show -s --format='%B' <commit>
|
||||
5. 写入后必须执行格式化,优先使用项目 Prettier,确保与"手动保存"风格一致:
|
||||
|
||||
```bash
|
||||
npx prettier --write docs/public/changelogs/cn.json
|
||||
npx prettier --write changelogs/cn.json
|
||||
```
|
||||
|
||||
6. 若环境没有 Prettier,回退为 `JSON.stringify(..., null, 2)` 的最小格式保证,并在输出中明确提示"未执行 Prettier 格式化"。
|
||||
@@ -117,7 +117,7 @@ npx prettier --write docs/public/changelogs/cn.json
|
||||
|
||||
补充检查:
|
||||
|
||||
5. 确认 `docs/public/changelogs/cn.json` 已经过 Prettier(若可用)。
|
||||
5. 确认 `changelogs/cn.json` 已经过 Prettier(若可用)。
|
||||
|
||||
## 7. 任务完成后询问
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
interface:
|
||||
display_name: '生成版本日志'
|
||||
short_description: '按版本区间提取提交并自动生成项目中文 changelog 文件'
|
||||
default_prompt: 'Use $generate-changelog to read package.json version, collect commits since the previous version, and update docs/changelogs_cn.json.'
|
||||
default_prompt: 'Use $generate-changelog to read package.json version, collect commits since the previous version, and update changelogs/cn.json.'
|
||||
@@ -1,6 +1,6 @@
|
||||
# changelog-format
|
||||
|
||||
本项目中文更新日志文件:`docs/changelogs_cn.json`
|
||||
本项目中文更新日志文件:`changelogs/cn.json`
|
||||
|
||||
## 顶层结构
|
||||
|
||||
|
||||
@@ -23,13 +23,13 @@ CHANGELOG_META="$(
|
||||
const exists=idx!==-1;
|
||||
const prev=exists ? (arr[idx+1]?.version||'') : (arr?.[0]?.version||'');
|
||||
process.stdout.write(JSON.stringify({exists, prev}));
|
||||
" "$ROOT_DIR/docs/changelogs_cn.json" "$CURRENT_VERSION"
|
||||
" "$ROOT_DIR/changelogs/cn.json" "$CURRENT_VERSION"
|
||||
)"
|
||||
|
||||
PREVIOUS_VERSION="$(node -e "const m=JSON.parse(process.argv[1]);process.stdout.write(m.prev||'');" "$CHANGELOG_META")"
|
||||
CURRENT_EXISTS="$(node -e "const m=JSON.parse(process.argv[1]);process.stdout.write(String(Boolean(m.exists)));" "$CHANGELOG_META")"
|
||||
if [[ -z "$PREVIOUS_VERSION" ]]; then
|
||||
echo "错误: 无法从 docs/changelogs_cn.json 读取上一版本" >&2
|
||||
echo "错误: 无法从 changelogs/cn.json 读取上一版本" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ set -euo pipefail
|
||||
|
||||
# 读取项目根目录(默认当前目录,可通过参数覆盖)
|
||||
ROOT_DIR="${1:-$(pwd)}"
|
||||
TARGET_FILE="$ROOT_DIR/docs/changelogs_cn.json"
|
||||
TARGET_FILE="$ROOT_DIR/changelogs/cn.json"
|
||||
|
||||
if [[ ! -f "$TARGET_FILE" ]]; then
|
||||
echo "错误: 未找到 $TARGET_FILE" >&2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: sync-changelog
|
||||
description: 将 docs/public/changelogs/cn.json 的当前版本日志同步为多语言版本:生成适合英文母语者阅读的英文版、适合繁体中文用户阅读的繁中版、适合日语母语者阅读的日文版,分别更新 docs/public/changelogs/en.json、docs/public/changelogs/tw.json、docs/public/changelogs/ja.json,并在当前项目创建 release 提交(包含 package.json 与四种语言 changelog)。用于用户提出"同步版本日志""生成并同步 changelog""发布前同步多语言日志"等请求。仅创建 commit,不执行 push。
|
||||
description: 将 changelogs/cn.json 的当前版本日志同步为多语言版本:生成适合英文母语者阅读的英文版、适合繁体中文用户阅读的繁中版、适合日语母语者阅读的日文版,分别更新 changelogs/en.json、changelogs/tw.json、changelogs/ja.json,并在当前项目创建 release 提交(包含 package.json 与四种语言 changelog)。用于用户提出"同步版本日志""生成并同步 changelog""发布前同步多语言日志"等请求。仅创建 commit,不执行 push。
|
||||
---
|
||||
|
||||
# sync-changelog
|
||||
@@ -11,7 +11,7 @@ description: 将 docs/public/changelogs/cn.json 的当前版本日志同步为
|
||||
|
||||
1. 当前仓库必须工作区干净:
|
||||
- 执行 `git status --porcelain`。
|
||||
- 允许白名单改动:`package.json`、`docs/public/changelogs/cn.json`(这两个文件可作为本次任务前置输入)。
|
||||
- 允许白名单改动:`package.json`、`changelogs/cn.json`(这两个文件可作为本次任务前置输入)。
|
||||
- 若存在白名单外改动(包含已暂存/未暂存/未跟踪),立即退出并提示用户手动处理。
|
||||
2. 当前仓库必须在 `main`:
|
||||
- 若不在 `main`,仅在工作区干净时执行 `git checkout main`。
|
||||
@@ -19,19 +19,19 @@ description: 将 docs/public/changelogs/cn.json 的当前版本日志同步为
|
||||
可复用脚本:`scripts/preflight_main_clean.sh` 当前仓库建议调用:
|
||||
|
||||
```bash
|
||||
scripts/preflight_main_clean.sh . "package.json,docs/public/changelogs/cn.json"
|
||||
scripts/preflight_main_clean.sh . "package.json,changelogs/cn.json"
|
||||
```
|
||||
|
||||
## 2. 读取当前版本并校验文件
|
||||
|
||||
1. 从 `docs/public/changelogs/cn.json` 读取第一个对象作为当前版本。
|
||||
1. 从 `changelogs/cn.json` 读取第一个对象作为当前版本。
|
||||
2. 读取版本号 `version`(例如 `0.9.6`)。
|
||||
3. **在开始翻译前,必须重新读取一次该版本的完整中文内容(`summary` 与 `changes`),并以这次读取结果作为唯一翻译源。**
|
||||
4. **严禁复用之前由 `generate-changelog` 或任意草稿步骤产出的缓存文案;若用户在生成后手动修改过中文日志,必须以用户修改后的文件内容为准。**
|
||||
5. 检查以下文件是否存在:
|
||||
- `docs/public/changelogs/en.json`
|
||||
- `docs/public/changelogs/tw.json`
|
||||
- `docs/public/changelogs/ja.json`
|
||||
- `changelogs/en.json`
|
||||
- `changelogs/tw.json`
|
||||
- `changelogs/ja.json`
|
||||
6. 任一目标文件不存在都立即退出,不允许自动创建。
|
||||
|
||||
## 3. 生成多语言 changelog(AI 翻译)
|
||||
@@ -45,9 +45,9 @@ scripts/preflight_main_clean.sh . "package.json,docs/public/changelogs/cn.json"
|
||||
- 繁体中文:以台湾常见产品文案口吻重写,避免简体直转。
|
||||
- 日文:使用自然、简洁、适合日本用户阅读的产品更新说明语气,避免中文式表达。
|
||||
3. 分别更新:
|
||||
- `docs/public/changelogs/en.json`
|
||||
- `docs/public/changelogs/tw.json`
|
||||
- `docs/public/changelogs/ja.json`
|
||||
- `changelogs/en.json`
|
||||
- `changelogs/tw.json`
|
||||
- `changelogs/ja.json`
|
||||
4. 每个目标文件都遵循相同规则:
|
||||
- 若已存在该版本,替换该版本对象。
|
||||
- 若不存在,插入到数组首位。
|
||||
@@ -58,10 +58,10 @@ scripts/preflight_main_clean.sh . "package.json,docs/public/changelogs/cn.json"
|
||||
|
||||
1. 提交文件必须包含:
|
||||
- `package.json`
|
||||
- `docs/public/changelogs/cn.json`
|
||||
- `docs/public/changelogs/en.json`
|
||||
- `docs/public/changelogs/tw.json`
|
||||
- `docs/public/changelogs/ja.json`
|
||||
- `changelogs/cn.json`
|
||||
- `changelogs/en.json`
|
||||
- `changelogs/tw.json`
|
||||
- `changelogs/ja.json`
|
||||
2. commit message:`release: v<version>`(示例:`release: v0.9.6`)。
|
||||
3. 仅创建 commit,不 push。
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
interface:
|
||||
display_name: '同步版本日志'
|
||||
short_description: '生成英/繁中/日文 changelog 并在双仓库创建提交(不推送)'
|
||||
default_prompt: 'Use $sync-changelog to turn the latest Chinese changelog entry into natural English, Traditional Chinese, and Japanese release notes, commit all localized changelog files in this repo, and sync them to ../chatlab.fun with a docs commit.'
|
||||
short_description: '生成英/繁中/日文 changelog 并创建 release 提交(不推送)'
|
||||
default_prompt: 'Use $sync-changelog to turn the latest Chinese changelog entry into natural English, Traditional Chinese, and Japanese release notes, and commit all localized changelog files in this repo.'
|
||||
@@ -1,6 +1,6 @@
|
||||
# japanese-release-style
|
||||
|
||||
用于将 `docs/changelogs_cn.json` 当前版本条目改写为日文版本。
|
||||
用于将 `changelogs/cn.json` 当前版本条目改写为日文版本。
|
||||
|
||||
## 目标
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# traditional-chinese-release-style
|
||||
|
||||
用于将 `docs/changelogs_cn.json` 当前版本条目改写为繁体中文版本。
|
||||
用于将 `changelogs/cn.json` 当前版本条目改写为繁体中文版本。
|
||||
|
||||
## 目标
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ if [[ -z "$REPO_PATH" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CN_FILE="$REPO_PATH/docs/public/changelogs/cn.json"
|
||||
EN_FILE="$REPO_PATH/docs/public/changelogs/en.json"
|
||||
TW_FILE="$REPO_PATH/docs/public/changelogs/tw.json"
|
||||
JA_FILE="$REPO_PATH/docs/public/changelogs/ja.json"
|
||||
CN_FILE="$REPO_PATH/changelogs/cn.json"
|
||||
EN_FILE="$REPO_PATH/changelogs/en.json"
|
||||
TW_FILE="$REPO_PATH/changelogs/tw.json"
|
||||
JA_FILE="$REPO_PATH/changelogs/ja.json"
|
||||
PKG_FILE="$REPO_PATH/package.json"
|
||||
|
||||
if [[ ! -f "$CN_FILE" || ! -f "$EN_FILE" || ! -f "$TW_FILE" || ! -f "$JA_FILE" || ! -f "$PKG_FILE" ]]; then
|
||||
@@ -30,10 +30,10 @@ fi
|
||||
# 注意:package.json 中的版本号需要和 release 提交一起落盘。
|
||||
git -C "$REPO_PATH" add \
|
||||
package.json \
|
||||
docs/public/changelogs/cn.json \
|
||||
docs/public/changelogs/en.json \
|
||||
docs/public/changelogs/tw.json \
|
||||
docs/public/changelogs/ja.json
|
||||
changelogs/cn.json \
|
||||
changelogs/en.json \
|
||||
changelogs/tw.json \
|
||||
changelogs/ja.json
|
||||
|
||||
# 若没有差异则不提交,避免空提交失败。
|
||||
if git -C "$REPO_PATH" diff --cached --quiet; then
|
||||
|
||||
Reference in new issue
Block a user