dtctl-release
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesedtctl Release Process
dtctl 发布流程
This skill walks through shipping a new dtctl release end-to-end. The process has six phases: analyze, version, changelog, test, commit/tag/push, and GitHub release notes.
此技能会逐步引导完成dtctl新版本的完整发布流程。该流程分为六个阶段:分析、版本确定、变更日志、测试、提交/打标签/推送,以及GitHub发布说明。
Prerequisites
前置条件
- You must be on the branch with all feature branches merged
main - The working tree must be clean (shows no uncommitted changes)
git status - If the user is on a feature branch, merge to main first (or ask them to)
Pre-flight check:
bash
git branch --show-current # Must be "main"
git status # Must be clean
git pull origin main # Must be up to date with remoteIf any check fails, stop and resolve before continuing.
- 你必须处于分支,且所有功能分支已合并
main - 工作树必须干净(显示无未提交变更)
git status - 如果用户当前在功能分支上,请先合并到main分支(或要求用户完成此操作)
预飞检查:
bash
git branch --show-current # 必须为"main"
git status # 必须干净
git pull origin main # 必须与远程仓库保持同步如果任何检查未通过,请先解决问题再继续。
Phase 1: Analyze Changes Since Last Release
阶段1:分析上次发布后的变更
Identify what changed since the last release to determine the version bump and write good release notes.
bash
undefined确定自上次发布以来的变更内容,以此决定版本升级幅度并撰写优质发布说明。
bash
undefinedFind the latest release tag
查找最新的发布标签
git tag --sort=-version:refname | head -5
git tag --sort=-version:refname | head -5
List all commits since that tag
列出该标签之后的所有提交
git log <last-tag>..HEAD --oneline
git log <last-tag>..HEAD --oneline
Check the current Unreleased section in CHANGELOG.md
查看CHANGELOG.md中的[Unreleased]章节
Read the commits carefully and group them into:
- **Features** (new commands, new flags, new integrations)
- **Bug fixes** (corrected behavior)
- **Documentation** (new or updated docs)
- **Security** (dependency updates, vulnerability fixes)
- **Breaking changes** (removed flags, changed defaults)
For each significant feature, explore the actual implementation files to understand what it does. Don't just rely on commit messages — read the code so you can write accurate, detailed release notes.
仔细阅读提交记录,并将其归类为:
- **功能**(新命令、新标志、新集成)
- **Bug修复**(修正的行为问题)
- **文档**(新增或更新的文档)
- **安全**(依赖更新、漏洞修复)
- **破坏性变更**(移除的标志、修改的默认值)
对于每个重要功能,请查看实际的实现文件以了解其功能。不要仅依赖提交信息——阅读代码才能撰写准确、详细的发布说明。Phase 2: Determine Version Number
阶段2:确定版本号
dtctl follows Semantic Versioning (currently pre-1.0, so 0.MINOR.PATCH):
| Change type | Bump | Example |
|---|---|---|
| New features, new commands | MINOR | 0.23.0 -> 0.24.0 |
| Bug fixes only, no new features | PATCH | 0.24.0 -> 0.24.1 |
| Breaking changes (pre-1.0) | MINOR | 0.24.0 -> 0.25.0 |
dtctl 遵循Semantic Versioning规范(当前为1.0版本前阶段,版本格式为0.MINOR.PATCH):
| 变更类型 | 升级幅度 | 示例 |
|---|---|---|
| 新增功能、新命令 | MINOR | 0.23.0 -> 0.24.0 |
| 仅Bug修复,无新增功能 | PATCH | 0.24.0 -> 0.24.1 |
| 破坏性变更(1.0版本前) | MINOR | 0.24.0 -> 0.25.0 |
Phase 3: Update Version and Changelog
阶段3:更新版本号与变更日志
3a. Bump version in code
3a. 在代码中升级版本号
Edit — change the variable:
pkg/version/version.goVersiongo
var Version = "X.Y.Z" // update thisThis is the only place the version is hardcoded. GoReleaser injects it at build time via , but the fallback value here should always match the latest release.
-ldflags编辑——修改变量:
pkg/version/version.goVersiongo
var Version = "X.Y.Z" // 更新此值这是唯一硬编码版本号的位置。GoReleaser会通过在构建时注入版本号,但此处的回退值应始终与最新版本保持一致。
-ldflags3b. Update CHANGELOG.md
3b. 更新CHANGELOG.md
The changelog follows Keep a Changelog format. Move items from into a new version section:
[Unreleased]markdown
undefined变更日志遵循Keep a Changelog格式。将中的条目移至新的版本章节:
[Unreleased]markdown
undefined[Unreleased]
[Unreleased]
[X.Y.Z] - YYYY-MM-DD
[X.Y.Z] - YYYY-MM-DD
Added
Added
- Feature name — description with enough detail that users understand what it does and how to use it; include CLI examples where relevant
- 功能名称 —— 描述需足够详细,让用户了解功能用途及使用方法;相关处需包含CLI示例
Fixed
Fixed
- Bug summary — what was broken and how it's fixed now
- Bug摘要 —— 说明问题所在及修复方式
Changed
Changed
- Change summary — what changed and why
- 变更摘要 —— 说明变更内容及原因
Security
Security
- Security fix — what was vulnerable and what was upgraded
- 安全修复 —— 说明漏洞所在及升级内容
Documentation
Documentation
- Doc name — what was added or updated
Also add the comparison link at the bottom of the file:
```markdown
[X.Y.Z]: https://github.com/dynatrace-oss/dtctl/compare/vPREVIOUS...vX.Y.ZIf a comparison link for the previous version is missing (check!), add that too.
- 文档名称 —— 说明新增或更新的内容
同时在文件底部添加对比链接:
```markdown
[X.Y.Z]: https://github.com/dynatrace-oss/dtctl/compare/vPREVIOUS...vX.Y.Z如果之前版本的对比链接缺失(请检查!),请一并添加。
Writing style for changelog entries
变更日志条目的撰写风格
- Start each entry with a bold feature/fix name in
**double asterisks** - Follow with an em dash and a description
— - Be specific: mention command names, flag names, file paths, environment variables
- For features, explain both what it does and how to use it
- For fixes, explain what was broken and what the correct behavior is now
- Use semicolons to chain related details in a single entry
- Keep entries to 1-3 lines each
- 每个条目以包裹的加粗功能/修复名称开头
**双星号** - 后跟破折号及描述内容
— - 内容要具体:提及命令名称、标志名称、文件路径、环境变量
- 对于功能,需说明用途及使用方法
- 对于修复,需说明问题所在及正确行为
- 使用分号连接单个条目中的相关细节
- 每个条目保持1-3行
Phase 4: Run Tests
阶段4:运行测试
Run the full test suite and build to catch any issues before releasing:
bash
undefined运行完整测试套件并构建,在发布前发现所有问题:
bash
undefinedRun all tests
运行所有测试
go test ./...
go test ./...
Build the binary
构建二进制文件
make build
make build
Verify the build works
验证构建结果
./bin/dtctl version
All tests must pass. If any fail, fix them before proceeding../bin/dtctl version
所有测试必须通过。如果有测试失败,请先修复再继续。Phase 5: Commit, Tag, and Push
阶段5:提交、打标签与推送
5a. Commit the release
5a. 提交发布变更
bash
git add CHANGELOG.md pkg/version/version.go
git commit -m "release vX.Y.Z: short summary of key features"The commit message should follow the pattern:
release vX.Y.Z: feature1, feature2, feature3bash
git add CHANGELOG.md pkg/version/version.go
git commit -m "release vX.Y.Z: 关键功能简短摘要"提交信息需遵循以下格式:
release vX.Y.Z: feature1, feature2, feature35b. Push and tag
5b. 推送并打标签
bash
git push origin main
git tag vX.Y.Z
git push origin vX.Y.ZPushing the tag triggers the GitHub Actions release workflow (), which automatically:
.github/workflows/release.yml- Builds cross-platform binaries (linux/darwin/windows, amd64/arm64)
- Signs checksums with cosign (keyless, via OIDC)
- Generates SBOMs with syft
- Creates a GitHub Release with auto-generated changelog
- Pushes an updated Homebrew cask to
dynatrace-oss/homebrew-tap
bash
git push origin main
git tag vX.Y.Z
git push origin vX.Y.Z推送标签会触发GitHub Actions发布工作流(),该工作流将自动:
.github/workflows/release.yml- 构建跨平台二进制文件(linux/darwin/windows,amd64/arm64)
- 使用cosign(无密钥,通过OIDC)对校验和签名
- 使用syft生成SBOM
- 创建包含自动生成变更日志的GitHub Release
- 将更新后的Homebrew cask推送到
dynatrace-oss/homebrew-tap
Homebrew
Homebrew
No manual Homebrew update is needed. GoReleaser's config in automatically pushes the updated cask to the tap repository using a GitHub App token. The setting prevents pre-release tags from being published.
homebrew_casks.goreleaser.yamlskip_upload: auto无需手动更新Homebrew。中的GoReleaser 配置会使用GitHub App令牌自动将更新后的cask推送到tap仓库。设置可防止预发布标签被发布。
.goreleaser.yamlhomebrew_casksskip_upload: autoPhase 6: Write GitHub Release Notes
阶段6:编写GitHub发布说明
After the tag is pushed, update the GitHub release with polished release notes. The auto-generated changelog from GoReleaser is a raw commit list — replace it with proper release notes.
bash
gh release edit vX.Y.Z --notes "$(cat <<'EOF'
... release notes here ...
EOF
)"推送标签后,使用优化后的发布说明更新GitHub Release。GoReleaser自动生成的变更日志是原始提交列表——需将其替换为规范的发布说明。
bash
gh release edit vX.Y.Z --notes "$(cat <<'EOF'
... 发布说明内容 ...
EOF
)"Release notes format
发布说明格式
Follow this exact structure (see previous releases for reference — ):
gh release view vPREVIOUSmarkdown
undefined请严格遵循以下结构(可参考过往版本——):
gh release view vPREVIOUSmarkdown
undefinedWhat's New
新功能
Feature Name
功能名称
Paragraph explaining the feature with context on why it's useful.
```bash
段落说明功能用途及实用场景。
```bash
Concrete usage example
具体使用示例
dtctl some-command --some-flag
```
Additional detail about configuration, behavior, or edge cases. Keep it practical — show users exactly how to use the feature.
dtctl some-command --some-flag
```
关于配置、行为或边缘情况的额外细节。内容需实用——向用户展示功能的具体使用方法。
Another Feature
另一项功能
...repeat for each major feature...
...为每个主要功能重复上述结构...
Bug Fixes
Bug修复
- Short fix title — one-line explanation of what was broken and what's fixed.
- Another fix — description.
- 简短修复标题 —— 一行说明问题所在及修复内容。
- 另一项修复 —— 说明内容。
Documentation
文档
- Doc title — what was added, with a link if applicable.
- 文档标题 —— 说明新增或更新的内容,如有需要可附带链接。
Install / Upgrade
安装/升级
```bash
```bash
Homebrew
Homebrew
brew update && brew upgrade dtctl
brew update && brew upgrade dtctl
Direct install
直接安装
curl -fsSL https://raw.githubusercontent.com/dynatrace-oss/dtctl/main/install.sh | bash
curl -fsSL https://raw.githubusercontent.com/dynatrace-oss/dtctl/main/install.sh | bash
Go install
Go安装
go install github.com/dynatrace-oss/dtctl@vX.Y.Z
```
undefinedgo install github.com/dynatrace-oss/dtctl@vX.Y.Z
```
undefinedRelease notes writing style
发布说明撰写风格
- Each major feature gets its own with a paragraph + code example
### Heading - Code examples should be copy-pasteable and realistic
- Bug fixes go in a single bulleted list under
## Bug Fixes - Always end with the block
## Install / Upgrade - Always end with the comparison link
**Full Changelog** - Omit sections that don't apply (e.g., no if there are no security fixes)
## Security - Study previous releases for tone and detail level: ,
gh release view v0.23.0gh release view v0.22.0
- 每个主要功能单独使用,并附带段落+代码示例
### 标题 - 代码示例应可直接复制使用且符合实际场景
- Bug修复需放在下的单个项目符号列表中
## Bug修复 - 结尾必须包含模块
## 安装/升级 - 结尾必须包含对比链接
**完整变更日志** - 可省略不适用的章节(例如:无安全修复时可省略章节)
## 安全 - 可参考过往版本的语气和详细程度:,
gh release view v0.23.0gh release view v0.22.0
Checklist
检查清单
Use this to track progress:
- On branch, clean working tree, up to date with remote
main - Analyzed all commits since last release
- Determined version number (semver)
- Updated
pkg/version/version.go - Updated (entries + comparison link)
CHANGELOG.md - Tests pass ()
go test ./... - Build succeeds ()
make build - Committed release changes on
main - Pushed to
origin/main - Created and pushed tag
vX.Y.Z - GitHub release notes written via
gh release edit
使用此清单跟踪进度:
- 处于分支,工作树干净,与远程仓库同步
main - 分析了上次发布后的所有提交
- 确定了版本号(遵循语义化版本规范)
- 更新了
pkg/version/version.go - 更新了(条目+对比链接)
CHANGELOG.md - 测试通过()
go test ./... - 构建成功()
make build - 在分支提交了发布变更
main - 推送到
origin/main - 创建并推送了标签
vX.Y.Z - 通过编写了GitHub发布说明
gh release edit