bump-release
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBump Release
升级版本发布(Bump Release)
Support for both regular and beta releases.
支持常规版本和Beta版本发布。
Parameters
参数
- : Optional explicit version to use (e.g.,
version). When provided, skips automatic version inference2.0.0 - : Create a beta release with
--betasuffix-beta.X - : Preview the release without making any changes (no file modifications, commits, or tags)
--dry-run
- :可选的指定版本号(例如:
version)。如果提供此参数,将跳过自动版本推断2.0.0 - :创建带有
--beta后缀的Beta版本-beta.X - :预览版本发布流程但不进行任何实际修改(不会修改文件、提交代码或打标签)
--dry-run
Steps
步骤
- Update the file with all changes since the last version release (skip this step for beta releases).
CHANGELOG.md - Bump the version in :
package.json- Regular release: Follow semantic versioning (e.g., 1.2.3)
- Beta release: Add suffix (e.g., 1.2.3-beta.1)
-beta.X
- Format files - If a exists in the repository, run
justfileto ensurejust full-writeandCHANGELOG.mdare properly formattedpackage.json - Commit the changes with a message like "docs: release <version>"
- Create a new git tag by running
git tag -a v<version> -m "<version>"
Note: When flag is provided, display what would be done without making any actual changes to files, creating commits, or tags.
--dry-run- 更新文件,记录上一个版本发布以来的所有变更(Beta版本发布可跳过此步骤)。
CHANGELOG.md - 升级中的版本号:
package.json- 常规版本发布:遵循Semantic Versioning规则(例如:1.2.3)
- Beta版本发布:添加后缀(例如:1.2.3-beta.1)
-beta.X
- 格式化文件 - 如果仓库中存在,运行
justfile以确保just full-write和CHANGELOG.md格式正确package.json - 提交变更,提交信息格式为“docs: release <version>”
- 通过运行创建新的Git标签
git tag -a v<version> -m "<version>"
注意:当使用参数时,仅展示将要执行的操作,不会对文件、提交或标签进行任何实际修改。
--dry-runTasks
任务流程
Process
—
- Check for arguments - Determine if was provided, if this is a beta release (
version), and/or dry-run (--beta)--dry-run - 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 contains a
package.jsonfield, only include changes within those specified files/directories. If nofilesfield exists, include all changes except test changes, CI/CD workflows, and development toolingfiles - Follow format - Use Common Changelog specification
- Check version - Get current version from
package.json - Bump version - If argument provided, use it directly. Otherwise, if unchanged since last release, increment per Semantic Versioning rules:
version- 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 (flag):
--beta- If current version has no beta suffix: Add to the version
-beta.1 - 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
- If current version has no beta suffix: Add
- For regular releases:
- 检查参数 - 确定是否提供了参数、是否为Beta版本(
version)以及是否启用了预览模式(--beta)--dry-run - 编写变更日志 - 对比当前分支与上一个标签的差异来编写变更日志。然后查看提交历史找到相关的PR,并将其添加到变更日志中(如果有)。如果中包含
package.json字段,仅记录该字段指定的文件/目录中的变更。如果没有files字段,则记录除测试代码、CI/CD工作流和开发工具之外的所有变更files - 遵循格式规范 - 使用Common Changelog规范
- 检查当前版本 - 从中获取当前版本号
package.json - 升级版本号 - 如果提供了参数,则直接使用该版本号。否则,如果自上一版本以来有变更,则按照Semantic Versioning规则递增版本号:
version- 常规版本发布:
- 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后缀:添加
- 常规版本发布:
Beta Release Logic
Beta版本发布逻辑
When flag is provided in the $ARGUMENTS
--beta- Check for explicit version - If provided:
version- If version already has beta suffix → use as-is
- If version has no beta suffix → append
-beta.1
- Otherwise, parse current version from and determine beta version:
package.json- If current version is : Create
1.2.3(increment patch + beta.1)1.2.4-beta.1 - If current version is : Create
1.2.3-beta.1(increment beta number)1.2.3-beta.2 - If current version is : Create
1.2.3-beta.5(increment beta number)1.2.3-beta.6
- If current version is
- Skip CHANGELOG.md update - Beta releases don't update the changelog
- Commit and tag with beta version (e.g., )
v1.2.4-beta.1
当$ARGUMENTS中包含参数时:
--beta- 检查指定版本号 - 如果提供了参数:
version- 如果版本号已有Beta后缀:直接使用该版本号
- 如果版本号没有Beta后缀:追加后缀
-beta.1
- 否则,解析当前版本号 - 从中获取当前版本号并确定Beta版本号:
package.json- 如果当前版本号是:创建
1.2.3(递增PATCH版本号并添加beta.1后缀)1.2.4-beta.1 - 如果当前版本号是:创建
1.2.3-beta.1(递增Beta编号)1.2.3-beta.2 - 如果当前版本号是:创建
1.2.3-beta.5(递增Beta编号)1.2.3-beta.6
- 如果当前版本号是
- 跳过更新CHANGELOG.md - Beta版本发布无需更新变更日志
- 提交并打标签 - 使用Beta版本号(例如:)
v1.2.4-beta.1
Output
输出内容
For regular releases only, in the file, generate changelog entries categorizing changes in this order:
CHANGELOG.md- 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 function for linear streams"
createLinear - "Remove deprecated method"
cancelStream - "Fix incorrect unlock time calculation in "
withdrawMax
仅针对常规版本发布,在文件中生成变更日志条目,按以下顺序分类:
CHANGELOG.md- Changed - 现有功能的变更
- Added - 新增功能
- Removed - 移除的功能
- Fixed - Bug修复
每个条目必须以动词原形开头。示例:
- "Update minimum Node.js version to 20"
- "Add function for linear streams"
createLinear - "Remove deprecated method"
cancelStream - "Fix incorrect unlock time calculation in "
withdrawMax
Inclusion Criteria
纳入规则
For regular releases only (changelog generation is skipped for beta releases):
- Files field constraint - If contains a
package.jsonfield, only include changes to files/directories specified in that array. All other codebase changes should be excluded from the CHANGELOGfiles - Production changes only - When no field exists, exclude test changes, CI/CD workflows, and development tooling
files - 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 - 仅生产变更 - 当没有字段时,排除测试代码、CI/CD工作流和开发工具的变更
files - 关联拉取请求 - 如果有相关PR,添加链接以提供上下文
- 仅净变更 - 对比当前分支与上一个标签的差异来识别变更
- 仅依赖和对等依赖变更 - 排除开发依赖(devDependencies)的变更
Examples
示例
Regular Release
常规版本发布
bash
undefinedbash
undefinedCreate 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
undefinedBeta Release
Beta版本发布
bash
undefinedbash
undefinedCreate 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
undefinedExplicit Version
指定版本号
bash
undefinedbash
undefinedSpecify 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
undefinedVersion Examples
版本示例
| Current Version | Release Type | New Version |
|---|---|---|
| Regular | |
| Beta | |
| Beta | |
| Regular | |
| | |
| | |
| 当前版本号 | 发布类型 | 新版本号 |
|---|---|---|
| 常规版本 | |
| Beta版本 | |
| Beta版本 | |
| 常规版本 | |
| 指定 | |
| 指定 | |