Skip to content

Commit 9f3ea4e

Browse files
committed
πŸ”–(obsidian) Generate release notes with git-cliff
1 parent 81afdee commit 9f3ea4e

4 files changed

Lines changed: 69 additions & 4 deletions

File tree

β€Ž.github/workflows/release.ymlβ€Ž

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ jobs:
1111
runs-on: ubuntu-latest
1212
permissions:
1313
contents: write
14+
pull-requests: read
1415

1516
steps:
1617
- uses: actions/checkout@v6
1718
with:
1819
fetch-depth: 0
1920

2021
- name: Setup Node.js
21-
uses: actions/setup-node@v4
22+
uses: actions/setup-node@v6
2223
with:
2324
node-version: 22
2425
cache: npm
@@ -48,13 +49,23 @@ jobs:
4849
- name: Verify release artifact
4950
run: npm run verify:release
5051

52+
- name: Generate changelog
53+
id: git-cliff
54+
uses: orhun/git-cliff-action@v4
55+
with:
56+
config: cliff.toml
57+
args: --latest --strip header
58+
env:
59+
OUTPUT: CHANGES.md
60+
GITHUB_REPO: ${{ github.repository }}
61+
5162
- name: Publish GitHub release
5263
uses: ncipollo/release-action@v1.21.0
5364
with:
5465
allowUpdates: true
5566
artifactErrorsFailBuild: true
5667
artifacts: "manifest.json,dist/main.js,dist/styles.css"
57-
generateReleaseNotes: true
68+
body: ${{ steps.git-cliff.outputs.content }}
5869
makeLatest: true
5970
name: ${{ github.ref_name }}
6071
tag: ${{ github.ref_name }}

β€Ž.github/workflows/validate.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/checkout@v6
1818

1919
- name: Setup Node.js
20-
uses: actions/setup-node@v4
20+
uses: actions/setup-node@v6
2121
with:
2222
node-version: 22
2323
cache: npm

β€ŽREADME.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ This plugin renders fenced code blocks like:
3535

3636
- CI runs on pushes to `main` and on pull requests via `.github/workflows/validate.yml`.
3737
- Releases run from exact version tags like `0.1.0`, not `v0.1.0`.
38-
- The release workflow verifies the tag matches both `package.json` and `manifest.json`, builds the plugin, and uploads `manifest.json`, `main.js`, and `styles.css` to the GitHub release.
38+
- The release workflow verifies the tag matches both `package.json` and `manifest.json`, builds the plugin, generates notes with `git-cliff`, and uploads `manifest.json`, `main.js`, and `styles.css` to the GitHub release.
3939
- Before creating a release tag locally, update the package version with `npm version <patch|minor|major>`, then push the commit and the matching tag.

β€Žcliff.tomlβ€Ž

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
[changelog]
2+
body = """
3+
{% for group, commits in commits | group_by(attribute="group") %}
4+
### {{ group }}
5+
6+
{% for commit in commits %}
7+
{%- set title = commit.message | split(pat="\n") | first | trim | split(pat=" (#") | first -%}
8+
{%- if commit.scope -%}
9+
{%- set clean_title = title | split(pat="(" ~ commit.scope ~ ")") | last | trim | trim_start_matches(pat=":") | trim -%}
10+
- [`{{ commit.id | truncate(length=7, end="") }}`](https://github.com/couchbaselabs/obsidian-couchbase-topology/commit/{{ commit.id }}) - **{{ commit.scope }}**: {{ clean_title }}{% if commit.remote.pr_number and commit.remote.username %} *(PR [#{{ commit.remote.pr_number }}](https://github.com/couchbaselabs/obsidian-couchbase-topology/pull/{{ commit.remote.pr_number }}) by [@{{ commit.remote.username }}](https://github.com/{{ commit.remote.username }}))*{% elif commit.remote.username %} *(commit by [@{{ commit.remote.username }}](https://github.com/{{ commit.remote.username }}))*{% elif commit.author.name %} *(commit by {{ commit.author.name }})*{% endif %}
11+
{% else %}
12+
{%- set first_token = title | split(pat=" ") | first -%}
13+
{%- set clean_title = title | replace(from=first_token ~ " ", to="") -%}
14+
- [`{{ commit.id | truncate(length=7, end="") }}`](https://github.com/couchbaselabs/obsidian-couchbase-topology/commit/{{ commit.id }}) - {{ clean_title }}{% if commit.remote.pr_number and commit.remote.username %} *(PR [#{{ commit.remote.pr_number }}](https://github.com/couchbaselabs/obsidian-couchbase-topology/pull/{{ commit.remote.pr_number }}) by [@{{ commit.remote.username }}](https://github.com/{{ commit.remote.username }}))*{% elif commit.remote.username %} *(commit by [@{{ commit.remote.username }}](https://github.com/{{ commit.remote.username }}))*{% elif commit.author.name %} *(commit by {{ commit.author.name }})*{% endif %}
15+
{%- endif %}
16+
{% endfor %}
17+
{% endfor %}
18+
"""
19+
20+
trim = true
21+
22+
[git]
23+
conventional_commits = false
24+
filter_unconventional = false
25+
filter_commits = true
26+
tag_pattern = "[0-9]+\\.[0-9]+\\.[0-9]+"
27+
sort_commits = "oldest"
28+
commit_preprocessors = [
29+
{ pattern = '^(πŸ’₯|✨️|✨|πŸŽ‰|🌱|🚩|πŸ₯š|πŸ‘”|🌐|✈️|πŸ¦–|πŸ›|πŸš‘οΈ|🩹|πŸ₯…|⚑️|🧡|πŸ”’οΈ|πŸ”’|πŸ”|πŸ›‚|🦺|βœ…|πŸ§ͺ|🀑|🧐|βš—οΈ|🚨|♻️|πŸ”₯|πŸ—‘οΈ|⚰️|πŸ’©|βͺ️|πŸ“|✏️|πŸ’¬|πŸ’‘|πŸ“„|πŸ‘₯|πŸ”οΈ|🎨|πŸ’„|♿️|🚸|πŸ“±|πŸ’«|🍱|πŸ“Έ|⬆️|⬆|⬇️|⬇|βž•|βž–|πŸ“Œ|πŸ‘½οΈ|πŸ‘·|πŸš€|πŸ”§|πŸ”¨|🚚|πŸ“¦οΈ|πŸ“¦|🧱|🩺|πŸ’š|πŸ”€|πŸ™ˆ|πŸ’Έ|πŸ§‘β€πŸ’»|🐳️|🐳|πŸ—οΈ|πŸ—ƒοΈ|πŸ“ˆ|🏷️|πŸ”Š|πŸ”‡|πŸ”–|🚧|🍻)([^\s(])', replace = "$1 $2" },
30+
{ pattern = ' ️', replace = '' },
31+
{ pattern = '^(\S+\)):\s*', replace = "$1 " },
32+
{ pattern = '^(\S+) #[0-9]+:\s*', replace = "$1 " },
33+
]
34+
35+
commit_parsers = [
36+
{ message = "^(?:πŸ’₯)(?:\\(([^)]+)\\))?", group = "πŸ’₯ Breaking Changes", scope = "${1}" },
37+
{ message = "^(?:✨️|✨)\\s+fix\\(([^)]+)\\)", group = "πŸ› Bug Fixes", scope = "${1}" },
38+
{ message = "^(?:✨|✨️|πŸŽ‰|🌱|🚩|πŸ₯š|πŸ‘”|🌐|✈️|πŸ¦–)(?:\\(([^)]+)\\))?", group = "✨ New Features", scope = "${1}" },
39+
{ message = "^(?:πŸ›|πŸš‘οΈ|🩹|πŸ₯…)(?:\\(([^)]+)\\))?", group = "πŸ› Bug Fixes", scope = "${1}" },
40+
{ message = "^(?:⚑️|🧡)(?:\\(([^)]+)\\))?", group = "⚑️ Performance", scope = "${1}" },
41+
{ message = "^(?:πŸ”’|πŸ”’οΈ|πŸ”|πŸ›‚|🦺)(?:\\(([^)]+)\\))?", group = "πŸ”’ Security", scope = "${1}" },
42+
{ message = "^(?:βœ…|πŸ§ͺ|🀑|🧐|βš—οΈ|🚨)(?:\\(([^)]+)\\))?", group = "πŸ§ͺ Tests & Quality", scope = "${1}" },
43+
{ message = "^(?:♻️|πŸ”₯|πŸ—‘οΈ|⚰️|πŸ’©|βͺ️)(?:\\(([^)]+)\\))?", group = "♻️ Refactors & Cleanup", scope = "${1}" },
44+
{ message = "^(?:πŸ“|✏️|πŸ’¬|πŸ’‘|πŸ“„|πŸ‘₯|πŸ”οΈ)(?:\\(([^)]+)\\))?", group = "πŸ“ Documentation & Content", scope = "${1}" },
45+
{ message = "^(?:🎨|πŸ’„|♿️|🚸|πŸ“±|πŸ’«|🍱|πŸ“Έ)(?:\\(([^)]+)\\))?", group = "🎨 UI/UX & Accessibility", scope = "${1}" },
46+
{ message = "^(?:⬆|⬇|⬆️|⬇️|βž•|βž–|πŸ“Œ|πŸ‘½οΈ)(?:\\(([^)]+)\\))?", group = "πŸ“¦ Dependencies", scope = "${1}" },
47+
{ message = "^(?:πŸ‘·|πŸš€|πŸ”§|πŸ”¨|🚚|πŸ“¦|πŸ“¦οΈ|🧱|🩺|πŸ’š|πŸ”€|πŸ™ˆ|πŸ’Έ|πŸ§‘β€πŸ’»|🐳|🐳️)(?:\\(([^)]+)\\))?", group = "πŸ”§ Infrastructure & DevOps", scope = "${1}" },
48+
{ message = "^(?:πŸ—οΈ|πŸ—ƒοΈ|πŸ“ˆ|🏷️)(?:\\(([^)]+)\\))?", group = "πŸ—οΈ Architecture & Data", scope = "${1}" },
49+
{ message = "^(?:πŸ”Š|πŸ”‡)(?:\\(([^)]+)\\))?", group = "πŸ”Š Logging", scope = "${1}" },
50+
{ message = "^(?:πŸ”–)(?:\\(([^)]+)\\))?", group = "πŸ”– Release & Versioning", scope = "${1}" },
51+
{ message = "^(?:🚧)(?:\\(([^)]+)\\))?", group = "🚧 Work In Progress", scope = "${1}" },
52+
{ message = "^(?:🍻)(?:\\(([^)]+)\\))?", group = "🍻 Miscellaneous", scope = "${1}" },
53+
{ message = ".*", group = "πŸ”Ή Other Changes" },
54+
]

0 commit comments

Comments
Β (0)