ci: Improve release notes for pre-releases #709
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
之前没设置好git-cliff(也可能是git-cliff有缺陷),预发布版的发行说明没有东西,例如 https://github.com/BITNP/BIThesis/releases/tag/v3.8.8-alpha.2 。
原因分析
(非常混乱,但 git-cliff 2.11.0 似乎确实如此……)
之前给git-cliff指定了
--unreleased。原以为git cliff --unreleased等于git cliff结果中的[unreleased]部分,实际上只是子集,具体情况要慢慢分析……git-cliff解析历史时,会把标签分为以下 2+1 = 3 类。分类方法受
ignore_tags和tag_pattern两项设置影响,且CLI设置(见.github/workflows/release.yml)会覆盖cliff.toml设置(ignore_tags = ".*alpha|beta|-.*";tag_pattern未设置,相当于.*)。tag_patterntag_pattern但不匹配ignore_tagstag_pattern且匹配ignore_tagstag_pattern在changelog模板中,有三个变量相关:
version:当前标签,可能为null--unreleased,则为null--current,则为HEAD对应的标签--latest,则为整个历史中的最新标签用 release.published 事件触发 GitHub Actions 时,release 对应的标签已经创建了,所以
--latest和--current效果相同。previous.version:上一正式标签commits:从上一有效标签到当前标签的提交记录对于当前标签为null的情况,上一有效标签就是HEAD。
以上理论可以解释目前所有现象。