mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-12 04:35:39 +08:00
Merge pull request #136 from denglihong2007/dev
ci: #132 添加 changelog 生成工具和配置
This commit is contained in:
11
.github/workflows/release.yml
vendored
11
.github/workflows/release.yml
vendored
@@ -68,10 +68,8 @@ jobs:
|
||||
with:
|
||||
dotnet-version: '9.0.x'
|
||||
|
||||
- name: Set Encoding
|
||||
run: |
|
||||
echo "DOTNET_CLI_UI_LANGUAGE=zh-CN" >> $GITHUB_ENV
|
||||
chcp 65001
|
||||
- name: Set up git-cliff
|
||||
uses: kenji-miyake/setup-git-cliff@v1
|
||||
|
||||
- name: Add GitHub Package Source
|
||||
env:
|
||||
@@ -85,7 +83,9 @@ jobs:
|
||||
dotnet build --configuration Release --no-restore
|
||||
|
||||
- name: Publish
|
||||
run: dotnet publish -c Release -o out
|
||||
run: |
|
||||
./tool/generate-changelog.ps1
|
||||
dotnet publish -c Release -o out
|
||||
|
||||
- name: Create Zip Package
|
||||
shell: pwsh
|
||||
@@ -97,5 +97,6 @@ jobs:
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: v${{ needs.check-version.outputs.new_version }}
|
||||
body_path: ./CHANGELOG.md
|
||||
name: ${{ needs.check-version.outputs.new_version }}
|
||||
files: CRSim-release-${{ needs.check-version.outputs.new_version }}.zip
|
||||
62
cliff.toml
Normal file
62
cliff.toml
Normal file
@@ -0,0 +1,62 @@
|
||||
[changelog]
|
||||
header = "更新日志"
|
||||
body = """
|
||||
{%- macro remote_url() -%}
|
||||
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{% macro print_commit(commit) -%}
|
||||
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
|
||||
{% if commit.breaking %}[**破坏性更改**] {% endif %}\
|
||||
{{ commit.message | upper_first }}\
|
||||
{% endmacro -%}
|
||||
|
||||
{% for group, commits in commits | group_by(attribute="group") %}
|
||||
## {{ group | striptags | trim | upper_first }}
|
||||
{% for commit in commits
|
||||
| filter(attribute="scope")
|
||||
| sort(attribute="scope") %}
|
||||
{{ self::print_commit(commit=commit) }}
|
||||
{%- endfor %}
|
||||
{% for commit in commits %}
|
||||
{%- if not commit.scope -%}
|
||||
{{ self::print_commit(commit=commit) }}
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
{% endfor -%}
|
||||
{%- if github -%}
|
||||
{% if github.contributors | length != 0 %}
|
||||
## 🙌 贡献者
|
||||
|
||||
感谢以下贡献者的贡献:
|
||||
{% endif %}\
|
||||
{% for contributor in github.contributors %}
|
||||
* @{{ contributor.username }}
|
||||
{%- endfor -%}
|
||||
{%- endif %}
|
||||
|
||||
|
||||
"""
|
||||
trim = true
|
||||
footer = "<!-- generated by git-cliff -->"
|
||||
postprocessors = [{ pattern = "#([0-9]+)", replace = "([#${1}](https://github.com/denglihong2007/CRSim/issues/${1}))"}]
|
||||
|
||||
[git]
|
||||
commit_parsers = [
|
||||
{ message = "^feat", group = "<!-- 0 -->🚀 新功能" },
|
||||
{ message = "^fix", group = "<!-- 1 -->🐛 Bug 修复" },
|
||||
{ message = "^doc", group = "<!-- 3 -->📚 文档" },
|
||||
{ message = "^perf", group = "<!-- 4 -->⚡ 性能" },
|
||||
{ message = "^refactor", group = "<!-- 2 -->🚜 重构" },
|
||||
{ message = "^style", group = "<!-- 5 -->🎨 界面" },
|
||||
{ message = "^test", group = "<!-- 6 -->🧪 测试" },
|
||||
{ message = "^chore\\(release\\): prepare for", skip = true },
|
||||
{ message = "^chore\\(deps.*\\)", skip = true },
|
||||
{ message = "^chore\\(pr\\)", skip = true },
|
||||
{ message = "^chore\\(pull\\)", skip = true },
|
||||
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ 杂项" },
|
||||
{ message = "^revert", group = "<!-- 8 -->◀️ 回退" },
|
||||
{ message = ".*", group = "<!-- 9 -->💼 其它" },
|
||||
]
|
||||
[commit_parsers]
|
||||
exclude = ["\\[skip cliff\\]"]
|
||||
5
tool/generate-changelog.ps1
Normal file
5
tool/generate-changelog.ps1
Normal file
@@ -0,0 +1,5 @@
|
||||
# 获取最新的 Git tag
|
||||
$latestTag = git describe --tags --abbrev=0
|
||||
|
||||
# 生成 changelog 并存储为最新 tag 名称的 Markdown 文件
|
||||
git cliff -t ${latestTag} --output "..\CHANGELOG.md"
|
||||
Reference in New Issue
Block a user