Skip to content

[🍅 tomato] feat(release): add automated release script #2

@nocoo

Description

@nocoo

目标

为 echo 添加自动化版本发布脚本 scripts/release.ts

规范

参考 pew 的 scripts/release.ts 实现(标杆)。

功能要求

  1. 版本 bump: 支持 patch(默认)、minor、major、显式版本号
  2. Dry-run 模式: bun run release -- --dry-run 预览变更
  3. 自动操作:
    • 更新 package.jsonversion 字段
    • 如果是 monorepo,同步所有子包的版本号
    • 如果有 src/**/version.ts 常量,一并更新
    • 同步 lockfile (bun install)
    • 生成/更新 CHANGELOG.md(从 conventional commits 生成)
    • Git commit + tag(格式: v{version}
    • Git push(含 tags)
    • 创建 GitHub Release(使用 gh release create

package.json scripts

{
  "scripts": {
    "release": "bun run scripts/release.ts"
  }
}

用法

bun run release              # patch bump
bun run release -- minor     # minor bump  
bun run release -- major     # major bump
bun run release -- 2.0.0     # explicit version
bun run release -- --dry-run # preview

技术细节

  • 框架: Hono (Bun)
  • 使用 child_process.spawn 执行 git/gh 命令
  • 脚本需要 gh CLI 已认证
  • 参考 pew 的实现: ~/workspace/personal/pew/scripts/release.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions