finish-release

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Pre-operation Checks

操作前检查

Verify working tree is clean and current branch matches
release/*
per
${CLAUDE_PLUGIN_ROOT}/references/invariants.md
.
确认工作区干净,且当前分支符合
release/*
格式,参考
${CLAUDE_PLUGIN_ROOT}/references/invariants.md

Phase 1: Identify Version

阶段1:确定版本号

Goal: Determine release version from current branch or argument.
Actions:
  1. If
    $ARGUMENTS
    provided, use it as version (strip 'v' prefix if present)
  2. Otherwise, extract from current branch:
    git branch --show-current
    (strip
    release/
    prefix)
  3. Store clean version without 'v' prefix (e.g., "1.0.0")
目标:从当前分支或参数中确定发布版本号。
操作步骤:
  1. 如果提供了
    $ARGUMENTS
    ,将其作为版本号(如果有'v'前缀则去除)
  2. 否则,从当前分支提取版本号:执行
    git branch --show-current
    (去除
    release/
    前缀)
  3. 存储不带'v'前缀的干净版本号(例如:"1.0.0")

Phase 2: Pre-finish Checks

阶段2:完成前检查

Goal: Run tests before finishing.
Actions:
  1. Identify test commands (check package.json, Makefile, etc.)
  2. Run tests if available; exit if tests fail
目标:在完成发布前运行测试。
操作步骤:
  1. 确定测试命令(检查package.json、Makefile等文件)
  2. 如果有可用测试则运行;若测试失败则退出流程

Phase 3: Update Changelog

阶段3:更新变更日志

Goal: Generate changelog from commits.
Actions:
  1. Get previous tag:
    git tag --sort=-v:refname | head -1
  2. Collect commits per
    ${CLAUDE_PLUGIN_ROOT}/references/changelog-generation.md
  3. Update CHANGELOG.md per
    ${CLAUDE_PLUGIN_ROOT}/examples/changelog.md
  4. Commit:
    chore: update changelog for v$VERSION
    with
    Co-Authored-By
    footer
目标:从提交记录生成变更日志。
操作步骤:
  1. 获取上一个标签:执行
    git tag --sort=-v:refname | head -1
  2. 参考
    ${CLAUDE_PLUGIN_ROOT}/references/changelog-generation.md
    收集提交记录
  3. 参考
    ${CLAUDE_PLUGIN_ROOT}/examples/changelog.md
    更新CHANGELOG.md文件
  4. 提交变更:使用
    chore: update changelog for v$VERSION
    作为提交信息,并添加
    Co-Authored-By
    脚注

Phase 4: Finish Release

阶段4:完成版本发布

Goal: Complete release using git-flow-next CLI.
Actions:
  1. Run
    git flow release finish $VERSION --tagname "v$VERSION" -m "Release v$VERSION"
  2. Verify current branch:
    git branch --show-current
    (should be on develop)
  3. Push all:
    git push origin main develop --tags
目标:使用git-flow-next CLI完成发布流程。
操作步骤:
  1. 执行
    git flow release finish $VERSION --tagname "v$VERSION" -m "Release v$VERSION"
  2. 确认当前分支:执行
    git branch --show-current
    (应处于develop分支)
  3. 推送所有内容:执行
    git push origin main develop --tags

Phase 5: GitHub Release

阶段5:创建GitHub发布

Goal: Create GitHub release from existing tag.
Actions:
  1. Extract changelog for this version from CHANGELOG.md
  2. Run
    gh release create "v$VERSION" --title "v$VERSION" --notes "<changelog>" --verify-tag
目标:基于现有标签创建GitHub发布。
操作步骤:
  1. 从CHANGELOG.md中提取该版本的变更日志内容
  2. 执行
    gh release create "v$VERSION" --title "v$VERSION" --notes "<changelog>" --verify-tag