Skip to content

Commit cb474a5

Browse files
ci: 发布使用自定义日志
1 parent e72d2ae commit cb474a5

2 files changed

Lines changed: 77 additions & 1 deletion

File tree

.git-cliff.toml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[changelog]
2+
body = """
3+
4+
## 插件更新
5+
> [!NOTE]
6+
> 当前版本:`{% if version %}({{ version }}){%- endif -%}`
7+
8+
{% for group, commits in commits | group_by(attribute="group") %}
9+
10+
{% if group != "✨ 新亮点" %}
11+
<details>
12+
<summary><h3>{{ group | upper_first }}</h3></summary>
13+
{% for commit in commits | unique(attribute="message") %}
14+
- {% if commit.scope %}{{ commit.scope }}: {%- endif -%}{{ commit.message | upper_first }}\
15+
{% if commit.remote.username %} 作者: @{{ commit.remote.username }}{%- endif -%}
16+
{% endfor %}
17+
</details>
18+
{% else %}
19+
### {{ group | upper_first }}
20+
{% for commit in commits | unique(attribute="message") %}
21+
- {% if commit.scope %}{{ commit.scope }}: {%- endif -%}{{ commit.message | upper_first }}\
22+
{% if commit.remote.username %} 作者: @{{ commit.remote.username }}{%- endif -%}
23+
{% endfor %}
24+
{% endif %}
25+
26+
{% endfor -%}
27+
28+
{% if version %}
29+
{% if previous.version %}
30+
**完整 Changelog**: 版本对比 {{ previous.version }} → {{ version }}
31+
{% endif %}
32+
{% else -%}
33+
{% raw %}
34+
{% endraw %}
35+
{% endif %}
36+
37+
"""
38+
trim = true
39+
footer = "<!-- generated by git-cliff -->"
40+
output = "CHANGELOG.md"
41+
42+
43+
[git]
44+
conventional_commits = true
45+
filter_unconventional = true
46+
split_commits = false
47+
commit_parsers = [
48+
{ message = "^feat", group = "✨ 新亮点"},
49+
{ message = "^fix", group = "🛠️ 修复的问题"},
50+
{ message = "^refactor", group = "🔃 功能重构"},
51+
{ message = "^docs", group = "📄 文档更新"},
52+
{ message = "^style", group = "🏞️ 样式优化"},
53+
]
54+
protect_breaking_commits = false
55+
filter_commits = true
56+
topo_order = false
57+
sort_commits = "oldest"
58+
link_parsers = []

.github/workflows/release.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ jobs:
2222
python-version: '>=3.9'
2323
cache: 'pip'
2424

25+
- name: Set up Rust
26+
uses: dtolnay/rust-toolchain@stable
27+
with:
28+
toolchain: stable
29+
profile: minimal
30+
override: true
31+
32+
- name: Install git-cliff
33+
run: |
34+
cargo install git-cliff
35+
2536
- name: Install dependencies
2637
run: |
2738
pip install -e .
@@ -37,6 +48,12 @@ jobs:
3748
id: get_version
3849
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
3950

51+
- name: Generate changelog with git-cliff
52+
id: generate_changelog
53+
run: |
54+
git-cliff --config .git-cliff.toml --tag v${{ env.VERSION }} > CHANGELOG.md
55+
echo "CHANGELOG=$(cat CHANGELOG.md)" >> $GITHUB_ENV
56+
4057
- name: Create Release
4158
id: create_release
4259
uses: softprops/action-gh-release@v2
@@ -47,4 +64,5 @@ jobs:
4764
files:
4865
- "*.cwplugin"
4966
- "*.zip"
50-
generate_release_notes: true
67+
body: ${{ env.CHANGELOG }}
68+
generate_release_notes: false

0 commit comments

Comments
 (0)