From 2f95a87ec2d9c9caabc95b870e57028c52286a70 Mon Sep 17 00:00:00 2001 From: Christopher Kolstad Date: Mon, 6 Jan 2025 14:17:54 +0100 Subject: [PATCH 1/3] Add dep-update prefix for dependabot upgrades --- .github/dependabot.yml | 4 ++++ .github/workflows/test-coverage.yaml | 4 +++- cliff.toml | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 46c7d70..0280bb4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,8 +5,12 @@ updates: schedule: interval: daily open-pull-requests-limit: 10 + commit-message: + prefix: "dep-update: " - package-ecosystem: github-actions directory: "/" schedule: interval: daily + commit-message: + prefix: "dep-update: " open-pull-requests-limit: 10 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 index 916a346..33e091a 100644 --- a/cliff.toml +++ b/cliff.toml @@ -69,6 +69,7 @@ commit_parsers = [ { message = "^refactor", group = "๐Ÿšœ Refactor" }, { message = "^style", group = "๐ŸŽจ Styling" }, { message = "^test", group = "๐Ÿงช Testing" }, + { message = "^dep-update", group = " Dependency updates" } { message = "^chore\\(release\\): prepare for", skip = true }, { message = "^chore\\(deps.*\\)", skip = true }, { message = "^chore\\(pr\\)", skip = true }, From 226fe53a7282620f3497fe84936f0fbc6cb48ead Mon Sep 17 00:00:00 2001 From: Christopher Kolstad Date: Mon, 6 Jan 2025 14:41:43 +0100 Subject: [PATCH 2/3] chore: release-plz also uses [changelog] in it's own config now --- cliff.toml | 87 ------------------------------------------------ release-plz.toml | 83 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 87 deletions(-) delete mode 100644 cliff.toml diff --git a/cliff.toml b/cliff.toml deleted file mode 100644 index 33e091a..0000000 --- a/cliff.toml +++ /dev/null @@ -1,87 +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 = "^dep-update", 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" }, -] -# 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..9ccc2a2 100644 --- a/release-plz.toml +++ b/release-plz.toml @@ -19,3 +19,86 @@ 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 = "^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 -%} +""" From 093e8dba5992faa02de049ca119e741d00ac1c87 Mon Sep 17 00:00:00 2001 From: Christopher Kolstad Date: Mon, 6 Jan 2025 14:50:44 +0100 Subject: [PATCH 3/3] just make sure release-plz understands build(deps) --- .github/dependabot.yml | 4 ---- release-plz.toml | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0280bb4..46c7d70 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,12 +5,8 @@ updates: schedule: interval: daily open-pull-requests-limit: 10 - commit-message: - prefix: "dep-update: " - package-ecosystem: github-actions directory: "/" schedule: interval: daily - commit-message: - prefix: "dep-update: " open-pull-requests-limit: 10 diff --git a/release-plz.toml b/release-plz.toml index 9ccc2a2..3019917 100644 --- a/release-plz.toml +++ b/release-plz.toml @@ -30,6 +30,7 @@ commit_parsers = [ { 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 },