bump-release

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Bump Release

升级版本发布(Bump Release)

Support for both regular and beta releases.
支持常规版本和Beta版本发布。

Parameters

参数

  • version
    : Optional explicit version to use (e.g.,
    2.0.0
    ). When provided, skips automatic version inference
  • --beta
    : Create a beta release with
    -beta.X
    suffix
  • --dry-run
    : Preview the release without making any changes (no file modifications, commits, or tags)
  • version
    :可选的指定版本号(例如:
    2.0.0
    )。如果提供此参数,将跳过自动版本推断
  • --beta
    :创建带有
    -beta.X
    后缀的Beta版本
  • --dry-run
    :预览版本发布流程但不进行任何实际修改(不会修改文件、提交代码或打标签)

Steps

步骤

  1. Update the
    CHANGELOG.md
    file with all changes since the last version release (skip this step for beta releases).
  2. Bump the version in
    package.json
    :
    • Regular release: Follow semantic versioning (e.g., 1.2.3)
    • Beta release: Add
      -beta.X
      suffix (e.g., 1.2.3-beta.1)
  3. Format files - If a
    justfile
    exists in the repository, run
    just full-write
    to ensure
    CHANGELOG.md
    and
    package.json
    are properly formatted
  4. Commit the changes with a message like "docs: release <version>"
  5. Create a new git tag by running
    git tag -a v<version> -m "<version>"
Note: When
--dry-run
flag is provided, display what would be done without making any actual changes to files, creating commits, or tags.
  1. 更新
    CHANGELOG.md
    文件,记录上一个版本发布以来的所有变更(Beta版本发布可跳过此步骤)。
  2. 升级
    package.json
    中的版本号:
    • 常规版本发布:遵循Semantic Versioning规则(例如:1.2.3)
    • Beta版本发布:添加
      -beta.X
      后缀(例如:1.2.3-beta.1)
  3. 格式化文件 - 如果仓库中存在
    justfile
    ,运行
    just full-write
    以确保
    CHANGELOG.md
    package.json
    格式正确
  4. 提交变更,提交信息格式为“docs: release <version>
  5. 通过运行
    git tag -a v<version> -m "<version>"
    创建新的Git标签
注意:当使用
--dry-run
参数时,仅展示将要执行的操作,不会对文件、提交或标签进行任何实际修改。

Tasks

任务流程

Process

  1. Check for arguments - Determine if
    version
    was provided, if this is a beta release (
    --beta
    ), and/or dry-run (
    --dry-run
    )
  2. Write Changelog - Examine diffs between the current branch and the previous tag to write Changelog. Then find relevant PRs by looking at the commit history and add them to each changelog (when available). If
    package.json
    contains a
    files
    field, only include changes within those specified files/directories. If no
    files
    field exists, include all changes except test changes, CI/CD workflows, and development tooling
  3. Follow format - Use Common Changelog specification
  4. Check version - Get current version from
    package.json
  5. Bump version - If
    version
    argument provided, use it directly. Otherwise, if unchanged since last release, increment per Semantic Versioning rules:
    • For regular releases:
      • PATCH (x.x.X) - Bug fixes, documentation updates
      • MINOR (x.X.x) - New features, backward-compatible changes
      • MAJOR (X.x.x) - Breaking changes
    • For beta releases (
      --beta
      flag):
      • If current version has no beta suffix: Add
        -beta.1
        to the version
      • If current version already has beta suffix: Increment beta number (e.g.,
        -beta.1
        -beta.2
        )
      • If moving from beta to release: Remove beta suffix and use the base version
  1. 检查参数 - 确定是否提供了
    version
    参数、是否为Beta版本(
    --beta
    )以及是否启用了预览模式(
    --dry-run
  2. 编写变更日志 - 对比当前分支与上一个标签的差异来编写变更日志。然后查看提交历史找到相关的PR,并将其添加到变更日志中(如果有)。如果
    package.json
    中包含
    files
    字段,仅记录该字段指定的文件/目录中的变更。如果没有
    files
    字段,则记录除测试代码、CI/CD工作流和开发工具之外的所有变更
  3. 遵循格式规范 - 使用Common Changelog规范
  4. 检查当前版本 - 从
    package.json
    中获取当前版本号
  5. 升级版本号 - 如果提供了
    version
    参数,则直接使用该版本号。否则,如果自上一版本以来有变更,则按照Semantic Versioning规则递增版本号:
    • 常规版本发布
      • PATCH(x.x.X):用于Bug修复、文档更新
      • MINOR(x.X.x):用于新增功能、向后兼容的变更
      • MAJOR(X.x.x):用于不兼容的破坏性变更
    • Beta版本发布(使用
      --beta
      参数):
      • 如果当前版本号没有Beta后缀:添加
        -beta.1
        后缀
      • 如果当前版本号已有Beta后缀:递增Beta编号(例如:
        -beta.1
        -beta.2
      • 如果从Beta版本转为正式版本:移除Beta后缀,使用基础版本号

Beta Release Logic

Beta版本发布逻辑

When
--beta
flag is provided in the $ARGUMENTS
  1. Check for explicit version - If
    version
    provided:
    • If version already has beta suffix → use as-is
    • If version has no beta suffix → append
      -beta.1
  2. Otherwise, parse current version from
    package.json
    and determine beta version:
    • If current version is
      1.2.3
      : Create
      1.2.4-beta.1
      (increment patch + beta.1)
    • If current version is
      1.2.3-beta.1
      : Create
      1.2.3-beta.2
      (increment beta number)
    • If current version is
      1.2.3-beta.5
      : Create
      1.2.3-beta.6
      (increment beta number)
  3. Skip CHANGELOG.md update - Beta releases don't update the changelog
  4. Commit and tag with beta version (e.g.,
    v1.2.4-beta.1
    )
当$ARGUMENTS中包含
--beta
参数时:
  1. 检查指定版本号 - 如果提供了
    version
    参数:
    • 如果版本号已有Beta后缀:直接使用该版本号
    • 如果版本号没有Beta后缀:追加
      -beta.1
      后缀
  2. 否则,解析当前版本号 - 从
    package.json
    中获取当前版本号并确定Beta版本号:
    • 如果当前版本号是
      1.2.3
      :创建
      1.2.4-beta.1
      (递增PATCH版本号并添加beta.1后缀)
    • 如果当前版本号是
      1.2.3-beta.1
      :创建
      1.2.3-beta.2
      (递增Beta编号)
    • 如果当前版本号是
      1.2.3-beta.5
      :创建
      1.2.3-beta.6
      (递增Beta编号)
  3. 跳过更新CHANGELOG.md - Beta版本发布无需更新变更日志
  4. 提交并打标签 - 使用Beta版本号(例如:
    v1.2.4-beta.1

Output

输出内容

For regular releases only, in the
CHANGELOG.md
file, generate changelog entries categorizing changes in this order:
  • Changed - Changes in existing functionality
  • Added - New functionality
  • Removed - Removed functionality
  • Fixed - Bug fixes
Every entry must begin with a verb in its base form. Examples:
  • "Update minimum Node.js version to 20"
  • "Add
    createLinear
    function for linear streams"
  • "Remove deprecated
    cancelStream
    method"
  • "Fix incorrect unlock time calculation in
    withdrawMax
    "
仅针对常规版本发布,在
CHANGELOG.md
文件中生成变更日志条目,按以下顺序分类:
  • Changed - 现有功能的变更
  • Added - 新增功能
  • Removed - 移除的功能
  • Fixed - Bug修复
每个条目必须以动词原形开头。示例:
  • "Update minimum Node.js version to 20"
  • "Add
    createLinear
    function for linear streams"
  • "Remove deprecated
    cancelStream
    method"
  • "Fix incorrect unlock time calculation in
    withdrawMax
    "

Inclusion Criteria

纳入规则

For regular releases only (changelog generation is skipped for beta releases):
  • Files field constraint - If
    package.json
    contains a
    files
    field, only include changes to files/directories specified in that array. All other codebase changes should be excluded from the CHANGELOG
  • Production changes only - When no
    files
    field exists, exclude test changes, CI/CD workflows, and development tooling
  • Reference pull requests - Link to PRs when available for context
  • Net changes only - Examine diffs between the current branch and the previous tag to identify changes
  • Only dependencies and peerDependencies changes - Exclude changes to devDependencies
仅针对常规版本发布(Beta版本发布跳过变更日志生成):
  • 文件字段约束 - 如果
    package.json
    中包含
    files
    字段,仅记录该数组中指定的文件/目录的变更。代码库中的其他变更应排除在变更日志之外
  • 仅生产变更 - 当没有
    files
    字段时,排除测试代码、CI/CD工作流和开发工具的变更
  • 关联拉取请求 - 如果有相关PR,添加链接以提供上下文
  • 仅净变更 - 对比当前分支与上一个标签的差异来识别变更
  • 仅依赖和对等依赖变更 - 排除开发依赖(devDependencies)的变更

Examples

示例

Regular Release

常规版本发布

bash
undefined
bash
undefined

Create a regular patch/minor/major release

创建常规补丁/小版本/大版本发布

/bump-release
/bump-release

Preview what a regular release would do

预览常规版本发布的操作

/bump-release --dry-run
undefined
/bump-release --dry-run
undefined

Beta Release

Beta版本发布

bash
undefined
bash
undefined

Create a beta release with -beta.X suffix

创建带有-beta.X后缀的Beta版本

/bump-release --beta
/bump-release --beta

Preview what a beta release would do

预览Beta版本发布的操作

/bump-release --beta --dry-run
undefined
/bump-release --beta --dry-run
undefined

Explicit Version

指定版本号

bash
undefined
bash
undefined

Specify exact version

指定精确版本号

/bump-release 2.0.0
/bump-release 2.0.0

Specify exact beta version

指定精确的Beta版本号

/bump-release 2.0.0-beta.1
/bump-release 2.0.0-beta.1

Combine with flags

组合使用参数

/bump-release 2.0.0 --dry-run
undefined
/bump-release 2.0.0 --dry-run
undefined

Version Examples

版本示例

Current VersionRelease TypeNew Version
1.2.3
Regular
1.2.4
(patch)
1.2.3
Beta
1.2.4-beta.1
1.2.3-beta.1
Beta
1.2.3-beta.2
1.2.3-beta.5
Regular
1.2.3
1.2.3
2.0.0
2.0.0
1.2.3
2.0.0
+ Beta
2.0.0-beta.1
当前版本号发布类型新版本号
1.2.3
常规版本
1.2.4
(补丁版)
1.2.3
Beta版本
1.2.4-beta.1
1.2.3-beta.1
Beta版本
1.2.3-beta.2
1.2.3-beta.5
常规版本
1.2.3
1.2.3
指定
2.0.0
2.0.0
1.2.3
指定
2.0.0
+Beta
2.0.0-beta.1