diff --git a/.claude/commands/release.md b/.claude/commands/release.md new file mode 100644 index 0000000..1a318e4 --- /dev/null +++ b/.claude/commands/release.md @@ -0,0 +1,66 @@ +执行本地发版流程,版本号为 $ARGUMENTS。 + +按以下步骤顺序执行,任意步骤失败立即停止并报告错误。 + +## 1. 检查工作区 + +检查是否有未提交的改动(`git status`)。如果有,列出文件并询问用户是否继续。 + +## 2. 本地构建 + +```bash +export PATH="/opt/homebrew/bin:$PATH" +cd backend && go build ./... +``` + +## 3. 运行测试 + +```bash +export PATH="/opt/homebrew/bin:$PATH" +cd backend && go test ./... +cd client && flutter analyze --no-fatal-infos --no-fatal-warnings +``` + +## 4. 更新 CHANGELOG.md + +检查 CHANGELOG.md 中是否已有 `## [$ARGUMENTS]` 版本节。 + +- **已有**:直接使用,不修改。 +- **没有**:读取 `git log` 从上一个 tag 到 HEAD 的提交记录,自动生成一个版本节插入到文件顶部(位于已有版本节之前),格式如下: + +``` +## [$ARGUMENTS] - <今天日期> + +### 新功能 +- ... + +### 改进 +- ... + +### 修复 +- ... +``` + +只保留有内容的分类(新功能/改进/修复),根据 commit message 的类型(feat/fix/refactor 等)归类。 + +## 5. 提交代码 + +将所有改动(包括 CHANGELOG.md)用以下格式提交到 main: + +``` +chore: release v$ARGUMENTS +``` + +## 6. 打 tag + +```bash +git tag v$ARGUMENTS +``` + +## 7. 推送 + +```bash +git push ssh://git@git.51yanmei.com:2222/wangjia/jiu.git main v$ARGUMENTS +``` + +推送成功后提示用户:CI/CD 已触发,等待 Telegram 通知。