Skip to content

Commit

Permalink
docs: set up python-semantic-release templates (#21)
Browse files Browse the repository at this point in the history
Fixes #3
  • Loading branch information
afuetterer authored May 19, 2024
1 parent ecf16ee commit bcd976a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/templates/.changes.j2
Original file line number Diff line number Diff line change
@@ -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 %}
4 changes: 4 additions & 0 deletions .github/templates/.release_notes.md.j2
Original file line number Diff line number Diff line change
@@ -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)) }}
21 changes: 21 additions & 0 deletions .github/templates/CHANGELOG.md.j2
Original file line number Diff line number Diff line change
@@ -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 -%}

0 comments on commit bcd976a

Please sign in to comment.