Skip to content

Commit

Permalink
chore: add custom templates for changelog and release notes
Browse files Browse the repository at this point in the history
Signed-off-by: Sietze van Buuren <[email protected]>
  • Loading branch information
swvanbuuren committed Nov 8, 2024
1 parent 724674e commit ffe32c8
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ include = ["mlpyqtgraph", "mlpyqtgraph.*"]
[tool.semantic_release]
version_variables = ["mlpyqtgraph/__init__.py:__version__"]
version_toml = ["pyproject.toml:project.version"]

[tool.semantic_release.changelog]
template_dir = "templates"
29 changes: 29 additions & 0 deletions templates/.release_notes.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{#
## 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 by %s ([`%s`](%s))\n" | format(
commit.descriptions[0].rstrip(),
commit.author.name,
commit.short_hash,
commit.hexsha | commit_hash_url,
)

}}{% endfor
%}{% endfor
%}
23 changes: 23 additions & 0 deletions templates/CHANGELOG.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# CHANGELOG

{% for version, release in ctx.history.released.items()
%}{{
"## %s (%s)" | format(version.as_tag(), release.tagged_date.strftime("%Y-%m-%d"))

}}{% for type_, commits in release["elements"] if type_ != "unknown" | dictsort
%}{{
"### %s" | format(type_ | title)

}}{% for commit in commits
%}{{
"\n* %s by %s ([`%s`](%s))\n" | format(
commit.descriptions[0].rstrip(),
commit.author.name,
commit.short_hash,
commit.hexsha | commit_hash_url,
)

}}{% endfor
%}{% endfor
%}{% endfor
%}

0 comments on commit ffe32c8

Please sign in to comment.