Mayo commited on
Commit
7bf7657
·
unverified ·
1 Parent(s): f753394

docs: tidy changelog

Browse files
Files changed (3) hide show
  1. CHANGELOG.md +0 -0
  2. cliff.toml +125 -0
  3. scripts/release.ts +1 -1
CHANGELOG.md CHANGED
The diff for this file is too large to render. See raw diff
 
cliff.toml ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # git-cliff ~ configuration file
2
+ # https://git-cliff.org/docs/configuration
3
+
4
+ [remote.github]
5
+ owner = "mayocream"
6
+ repo = "koharu"
7
+
8
+ [changelog]
9
+ # A Tera template to be rendered for each release in the changelog.
10
+ # See https://keats.github.io/tera/docs/#introduction
11
+ body = """
12
+ {%- macro remote_url() -%}
13
+ https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
14
+ {%- endmacro -%}
15
+
16
+ {% macro print_commit(commit) -%}
17
+ - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
18
+ {% if commit.breaking %}[**breaking**] {% endif %}\
19
+ {{ commit.message | upper_first }} - \
20
+ ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
21
+ {% endmacro -%}
22
+
23
+ {% if version %}\
24
+ {% if previous.version %}\
25
+ ## [{{ version | trim_start_matches(pat="v") }}]\
26
+ ({{ self::remote_url() }}/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
27
+ {% else %}\
28
+ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
29
+ {% endif %}\
30
+ {% else %}\
31
+ ## [unreleased]
32
+ {% endif %}\
33
+
34
+ {% for group, commits in commits | group_by(attribute="group") %}
35
+ ### {{ group | striptags | trim | upper_first }}
36
+ {% for commit in commits
37
+ | filter(attribute="scope")
38
+ | sort(attribute="scope") %}
39
+ {{ self::print_commit(commit=commit) }}
40
+ {%- endfor %}
41
+ {% for commit in commits %}
42
+ {%- if not commit.scope -%}
43
+ {{ self::print_commit(commit=commit) }}
44
+ {% endif -%}
45
+ {% endfor -%}
46
+ {% endfor -%}
47
+ {%- if github -%}
48
+ {% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
49
+ ## New Contributors ❤️
50
+ {% endif %}\
51
+ {% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
52
+ * @{{ contributor.username }} made their first contribution
53
+ {%- if contributor.pr_number %} in \
54
+ [#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
55
+ {%- endif %}
56
+ {%- endfor -%}
57
+ {%- endif %}
58
+
59
+
60
+ """
61
+ # A Tera template to be rendered as the changelog's footer.
62
+ # See https://keats.github.io/tera/docs/#introduction
63
+ footer = """
64
+ <!-- generated by git-cliff -->
65
+ """
66
+ # Remove leading and trailing whitespaces from the changelog's body.
67
+ trim = true
68
+ # An array of regex based postprocessors to modify the changelog.
69
+ postprocessors = [
70
+ # Replace the placeholder `<REPO>` with a URL.
71
+ { pattern = '<REPO>', replace = "https://github.com/mayocream/koharu" }, # replace repository URL
72
+ ]
73
+
74
+ [git]
75
+ # Parse commits according to the conventional commits specification.
76
+ # See https://www.conventionalcommits.org
77
+ conventional_commits = true
78
+ # Exclude commits that do not match the conventional commits specification.
79
+ filter_unconventional = false
80
+ # Split commits on newlines, treating each line as an individual commit.
81
+ split_commits = false
82
+ # An array of regex based parsers to modify commit messages prior to further processing.
83
+ commit_preprocessors = [
84
+ # Replace issue numbers with link templates to be updated in `changelog.postprocessors`.
85
+ { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))" },
86
+ ]
87
+ # An array of regex based parsers for extracting data from the commit message.
88
+ # Assigns commits to groups.
89
+ # Optionally sets the commit's scope and can decide to exclude commits from further processing.
90
+ commit_parsers = [
91
+ { message = "^feat", group = "<!-- 0 -->⛰️ Features" },
92
+ { message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
93
+ { message = "^doc", group = "<!-- 3 -->📚 Documentation" },
94
+ { message = "^perf", group = "<!-- 4 -->⚡ Performance" },
95
+ { message = "^refactor\\(clippy\\)", skip = true },
96
+ { message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
97
+ { message = "^style", group = "<!-- 5 -->🎨 Styling" },
98
+ { message = "^test", group = "<!-- 6 -->🧪 Testing" },
99
+ { message = "^chore\\(release\\): prepare for", skip = true },
100
+ { message = "^chore\\(deps.*\\)", skip = true },
101
+ { message = "^chore\\(pr\\)", skip = true },
102
+ { message = "^chore\\(pull\\)", skip = true },
103
+ { message = "^chore\\(npm\\).*yarn\\.lock", skip = true },
104
+ { message = "^chore.*release", skip = true },
105
+ { message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
106
+ { body = ".*security", group = "<!-- 8 -->🛡️ Security" },
107
+ { message = "^revert", group = "<!-- 9 -->◀️ Revert" },
108
+ ]
109
+ # Prevent commits that are breaking from being excluded by commit parsers.
110
+ protect_breaking_commits = false
111
+ # Exclude commits that are not matched by any commit parser.
112
+ filter_commits = false
113
+ # Regex to select git tags that represent releases.
114
+ tag_pattern = "[0-9].*"
115
+ # Regex to select git tags that do not represent proper releases.
116
+ # Takes precedence over `tag_pattern`.
117
+ # Changes belonging to these releases will be included in the next release.
118
+ skip_tags = "beta|alpha"
119
+ # Regex to exclude git tags after applying the tag_pattern.
120
+ ignore_tags = "rc"
121
+ # Order releases topologically instead of chronologically.
122
+ topo_order = false
123
+ # Order of commits in each group/release within the changelog.
124
+ # Allowed values: newest, oldest
125
+ sort_commits = "newest"
scripts/release.ts CHANGED
@@ -38,7 +38,7 @@ async function main() {
38
  console.log('Updated Cargo.lock')
39
 
40
  await exec('git add Cargo.toml Cargo.lock', execOpts)
41
- await exec(`git commit -m "chore: release ${bumpedVersion}"`, execOpts)
42
  console.log('Created release commit')
43
 
44
  await exec(`git tag ${bumpedVersion}`, execOpts)
 
38
  console.log('Updated Cargo.lock')
39
 
40
  await exec('git add Cargo.toml Cargo.lock', execOpts)
41
+ await exec(`git commit -m "chore(release): ${bumpedVersion}"`, execOpts)
42
  console.log('Created release commit')
43
 
44
  await exec(`git tag ${bumpedVersion}`, execOpts)