diff --git a/.github/templates/.changes.j2 b/.github/templates/.changes.j2 new file mode 100644 index 0000000..076ac09 --- /dev/null +++ b/.github/templates/.changes.j2 @@ -0,0 +1,16 @@ +{%- set commit_type_heading_mapping = ( + ("breaking", "Breaking Changes"), + ("feature", "Features"), + ("fix", "Bug Fixes"), + ("performance", "Performance improvements"), + ("refactor", "Code Refactoring"), + ("test", "Testing"), + ("documentation", "Documentation"), +) -%} + +{% for commit_type, heading in commit_type_heading_mapping if commit_type in release["elements"] %} +### {{ heading }} + +{% for commit in release["elements"][commit_type] -%} +- {% if commit.scope %}**{{ commit.scope }}:** {% endif %}{{ commit.descriptions[0] }} ([`{{ commit.short_hash }}`]({{ commit.hexsha|commit_hash_url }})) +{% endfor %}{% endfor %} diff --git a/.github/templates/.release_notes.md.j2 b/.github/templates/.release_notes.md.j2 new file mode 100644 index 0000000..b548528 --- /dev/null +++ b/.github/templates/.release_notes.md.j2 @@ -0,0 +1,4 @@ +{%- set releases = context.history.released.items() | list -%} +{%- set prev_version = releases[1][0] -%} +{% include ".changes.j2" %} +{{ "**Full Changelog**: (%s)" | format(prev_version | compare_url(version)) }} diff --git a/.github/templates/CHANGELOG.md.j2 b/.github/templates/CHANGELOG.md.j2 new file mode 100644 index 0000000..b7c967e --- /dev/null +++ b/.github/templates/CHANGELOG.md.j2 @@ -0,0 +1,21 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). See +[conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for commit guidelines. + +{# UNRELEASED -#} +{% set last_release = context.history.released.items() | first | first -%} +## {{ "[Unreleased](%s)" | format(last_release.as_tag() | compare_url("main")) }} + +{# RELEASED -#} +{% for version, release in context.history.released.items() -%} +{%- if loop.nextitem -%} +{%- set compare_url_ = loop.nextitem[0] | compare_url(version) -%} +## [{{ version.as_tag() }}]({{ compare_url_ }}) ({{ release.tagged_date.strftime("%Y-%m-%d") }}) +{% else -%} +## {{ version.as_tag() }} ({{ release.tagged_date.strftime("%Y-%m-%d") }}) +{% endif -%} +{% include ".changes.j2" %} +{%- endfor -%}