diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 9e6e4c5..4001b90 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -23,7 +23,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Install rust run: | rustup set auto-self-update disable diff --git a/cliff.toml b/cliff.toml deleted file mode 100644 index 916a346..0000000 --- a/cliff.toml +++ /dev/null @@ -1,86 +0,0 @@ -# git-cliff ~ default configuration file -# https://git-cliff.org/docs/configuration -# -# Lines starting with "#" are comments. -# Configuration options are organized into tables and keys. -# See documentation for more information on available options. - -[changelog] -# template for the changelog header -header = """ -# Changelog\n -All notable changes to this project will be documented in this file.\n -""" -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ -{% if version %}\ - ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} -{% else %}\ - ## [unreleased] -{% endif %}\ -{% for group, commits in commits | group_by(attribute="group") %} - ### {{ group | striptags | trim | upper_first }} - {% for commit in commits %} - - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\ - {% if commit.breaking %}[**breaking**] {% endif %}\ - {{ commit.message | split(pat="\n") | first | upper_first | trim }}\ - {% if commit.remote.username %} by @{{ commit.remote.username }}{%- endif %}\ - {% if commit.remote.pr_number %} in #{{ commit.remote.pr_number }}{%- endif %} - {% endfor %} -{% endfor %}\n -""" -# template for the changelog footer -footer = """ - -""" -# remove the leading and trailing s -trim = true -# postprocessors -postprocessors = [ - { pattern = '', replace = "https://github.com/unleash/unleash-types-rs" }, # replace repository URL -] -# render body even when there are no releases to process -# render_always = true -# output file path -# output = "test.md" - -[git] -# parse the commits based on https://www.conventionalcommits.org -conventional_commits = true -# filter out the commits that are not conventional -filter_unconventional = false -# process each line of a commit as an individual commit -split_commits = false -# regex for preprocessing the commit messages -commit_preprocessors = [ - # Replace issue numbers - { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](/issues/${2}))"}, - # Check spelling of the commit with https://github.com/crate-ci/typos - # If the spelling is incorrect, it will be automatically fixed. - { pattern = '.*', replace_command = 'typos --write-changes -' }, -] -# regex for parsing and grouping commits -commit_parsers = [ - { message = "^feat", group = "๐Ÿš€ Features" }, - { message = "^fix", group = "๐Ÿ› Bug Fixes" }, - { message = "^doc", group = "๐Ÿ“š Documentation" }, - { message = "^perf", group = "โšก Performance" }, - { message = "^refactor", group = "๐Ÿšœ Refactor" }, - { message = "^style", group = "๐ŸŽจ Styling" }, - { message = "^test", group = "๐Ÿงช Testing" }, - { 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 = "โš™๏ธ Miscellaneous Tasks" }, - { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, - { message = "^revert", group = "โ—€๏ธ Revert" }, - { message = ".*", group = "๐Ÿ’ผ Other" }, -] -# filter out the commits that are not matched by commit parsers -filter_commits = false -# sort the tags topologically -topo_order = false -# sort the commits inside sections by oldest/newest order -sort_commits = "oldest" diff --git a/release-plz.toml b/release-plz.toml index 1c6d41c..3019917 100644 --- a/release-plz.toml +++ b/release-plz.toml @@ -19,3 +19,87 @@ publish_allow_dirty = false semver_check = false +[changelog] + +commit_parsers = [ + { message = "^feat", group = "๐Ÿš€ Features" }, + { message = "^fix", group = "๐Ÿ› Bug Fixes" }, + { message = "^doc", group = "๐Ÿ“š Documentation" }, + { message = "^perf", group = "โšก Performance" }, + { message = "^refactor", group = "๐Ÿšœ Refactor" }, + { message = "^style", group = "๐ŸŽจ Styling" }, + { message = "^test", group = "๐Ÿงช Testing" }, + { message = "^dep-update", group = " Dependency updates" }, + { message = "^build(deps)", group = " Dependency updates" }, + { 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 = "โš™๏ธ Miscellaneous Tasks" }, + { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, + { message = "^revert", group = "โ—€๏ธ Revert" }, + { message = ".*", group = "๐Ÿ’ผ Other" }, +] + +commit_preprocessors = [ + # Replace `foo` with `bar` + { pattern = "foo", replace = "bar" }, + + # Replace `` in the template body with the repository URL + { pattern = '', replace = "https://github.com/unleash/unleash-types-rs" }, + + # Replace multiple spaces with a single space. + { pattern = " +", replace = " " }, + + # Replace the issue number with the link. + { pattern = "\\(#([0-9]+)\\)", replace = "([#${1}](https://github.com/unleash/unleash-types-rs/issues/${1}))" }, + # Remove prefix + { pattern = 'Merged PR #[0-9]: (.*)', replace = "$1" }, + + # Remove gitmoji from commit messages, both actual UTF emoji and :emoji: + { pattern = ' *(:\w+:|[\p{Emoji_Presentation}\p{Extended_Pictographic}\u{200D}]) *', replace = "" }, + + # Hyperlink PR references from merge commits. + { pattern = "Merge pull request #([0-9]+) from [^ ]+", replace = "PR # [${1}](https://github.com/unleash/unleash-types-rs/pull/${1}):" }, + + # Hyperlink commit links, with short commit hash as description. + { pattern = "https://github.com/unleash/unleash-types-rs/commit/([a-f0-9]{7})[a-f0-9]*", replace = "commit # [${1}](${0})" }, + + # Hyperlink bare commit hashes like "abcd1234" in commit logs, with short commit hash as description. + { pattern = "([ \\n])(([a-f0-9]{7})[a-f0-9]*)", replace = "${1}commit # [${3}](https://github.com/unleash/unleash-types-rs/commit/${2})" }, +] + +body = """ + +## [{{ version | trim_start_matches(pat="v") }}]\ + {%- if release_link -%}\ + ({{ release_link }})\ + {% endif %} \ + - {{ timestamp | date(format="%Y-%m-%d") }} +{% for group, commits in commits | group_by(attribute="group") %} +### {{ group | upper_first }} + {% for commit in commits %} + {%- if commit.scope -%} + - *({{commit.scope}})* {% if commit.breaking %}[**breaking**] {% endif %}\ + {{ commit.message }}{{ self::username(commit=commit) }}\ + {%- if commit.links %} \ + ({% for link in commit.links %}[{{link.text}}]({{link.href}}) {% endfor -%})\ + {% endif %} + {% else -%} + - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }}{{ self::username(commit=commit) }}{{ self::pr(commit=commit) }} + {% endif -%} + {% endfor -%} +{% endfor %} +{%- if remote.contributors %} +### Contributors +{% for contributor in remote.contributors %} + * @{{ contributor.username }} +{%- endfor %} +{% endif -%} +{%- macro username(commit) -%} + {% if commit.remote.username %} (by @{{ commit.remote.username }}){% endif -%} +{% endmacro -%} +{%- macro pr(commit) -%} + {% if commit.remote.pr_number %} - #{{ commit.remote.pr_number }}{% endif -%} +{% endmacro -%} +"""