diff --git a/.github/templates/.release_notes.md.j2 b/.github/templates/.release_notes.md.j2 new file mode 100644 index 0000000..4fc1215 --- /dev/null +++ b/.github/templates/.release_notes.md.j2 @@ -0,0 +1,28 @@ +{# + +## vX.X.X (YYYY-MMM-DD) + +#}{{ + + "## %s (%s)\n" | format( + release.version.as_semver_tag(), + release.tagged_date.strftime("%Y-%m-%d") + ) + +}}{% set commit_objects = release["elements"] | dictsort +%}{# +#}{% for type_, commits in commit_objects +%}{{ + "\n### %s\n" | format(type_ | title) + +}}{% for commit in commits +%}{{ + "\n* %s ([`%s`](%s))\n" | format( + commit.descriptions[0].rstrip(), + commit.short_hash, + commit.hexsha | commit_hash_url, + ) + +}}{% endfor +%}{% endfor +%} diff --git a/.github/templates/CHANGELOG.md.j2 b/.github/templates/CHANGELOG.md.j2 new file mode 100644 index 0000000..c4da347 --- /dev/null +++ b/.github/templates/CHANGELOG.md.j2 @@ -0,0 +1,24 @@ +# CHANGELOG + +{% for version, release in ctx.history.released.items() +%}{{ + "## %s (%s)\n" | format(version.as_tag(), release.tagged_date.strftime("%Y-%m-%d")) + +}}{% set commit_objects = release["elements"] | dictsort +%}{# +#}{% for type_, commits in commit_objects if type_ != "unknown" +%}{{ + "\n### %s\n" | format(type_ | title) + +}}{% for commit in commits +%}{{ + "\n* %s ([`%s`](%s))\n" | format( + commit.descriptions[0].rstrip(), + commit.short_hash, + commit.hexsha | commit_hash_url + ) + +}}{% endfor +%}{% endfor +%}{% endfor +%} diff --git a/pyproject.toml b/pyproject.toml index 8ce5db2..c03b0a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,3 +36,6 @@ include = ["simple_cdd_yaml", "simple_cdd_yaml.*"] [tool.semantic_release] version_variables = ["simple_cdd_yaml/__init__.py:__version__"] version_toml = ["pyproject.toml:project.version"] + +[tool.semantic_release.changelog] +template_dir = ".github/templates"