diff --git a/pyproject.toml b/pyproject.toml index ec2cc17..7eed4b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ prerelease = false [tool.semantic_release.changelog] template_dir = "templates" changelog_file = "CHANGELOG.md" -exclude_commit_patterns = ["^build: *", "^chore: *", "^ci: *", "^test: *"] +exclude_commit_patterns = ["^build: *", "^chore: *", "^test: *"] [tool.semantic_release.changelog.environment] block_start_string = "{%" @@ -55,7 +55,7 @@ allowed_tags = [ "test", ] minor_tags = ["feat"] -patch_tags = ["fix", "perf", "refactor"] +patch_tags = ["fix", "perf", "refactor", "docs", "ci"] default_bump_level = 0 [tool.semantic_release.remote] diff --git a/templates/.macros.j2 b/templates/.macros.j2 deleted file mode 100644 index 5cabaa3..0000000 --- a/templates/.macros.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{# This template module holds variables and macros for use in other templates #} - -{# - The filter for releases that aren't already in the historic CHANGELOG (which - gets included at the end of this template) is done by release tag timestamp - instead of version since the version comparison is only possible as strings, - which does not properly account for individual components of the version. - New timestamps can be computed in Python as: -#} - -{% macro version_compare_url(prev_version, version) -%} -https://github.com/{{ context.repo_owner }}/{{ context.repo_name }}/compare/v{{ prev_version }}...v{{ version }} -{%- endmacro %} - -{% macro changelog_file_url() -%} -https://github.com/{{ context.repo_owner }}/{{ context.repo_name }}/blob/main/CHANGELOG.md -{%- endmacro %} diff --git a/templates/.release_notes.md.j2 b/templates/.release_notes.md.j2 index 3ce3fdc..e7082e9 100644 --- a/templates/.release_notes.md.j2 +++ b/templates/.release_notes.md.j2 @@ -1,8 +1,3 @@ -{# - This is a Jinja template for generating release notes with Python Semantic Release. - Ref: https://python-semantic-release.readthedocs.io/en/latest/changelog_templates.html -#} - ## What's Changed {% for type_, commits in release["elements"] | dictsort %} ### {{ type_ | capitalize }} @@ -10,14 +5,3 @@ {% for commit in commits %} * {{ commit.descriptions[0] }} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }})) {%- endfor %}{% endif %}{% endfor %} - -{% from ".macros.j2" import version_compare_url %} -{% from ".macros.j2" import changelog_file_url %} - -{% set releases = context.history.released.items() | list %} -{% set prev_version = releases[1][0] %} -{% set full_changelog_url = version_compare_url(prev_version, version) %} - -**Full changes**: {{ full_changelog_url }} - -**All changelog**: [CHANGELOG.md]({{ changelog_file_url() }}) diff --git a/templates/CHANGELOG.md.j2 b/templates/CHANGELOG.md.j2 index fee490d..c1b3eb2 100644 --- a/templates/CHANGELOG.md.j2 +++ b/templates/CHANGELOG.md.j2 @@ -1,5 +1,5 @@ # CHANGELOG -{% if context.history.unreleased | length > 0 %} +{% if context.history.unreleased | length > 0 -%} {# UNRELEASED #} ## Unreleased {% for type_, commits in context.history.unreleased | dictsort %} @@ -8,8 +8,8 @@ * {{ commit.message.rstrip() }} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }})) {% else %} * {{ commit.message.rstrip() }} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }})) -{% endif %}{% endfor %}{% endfor %}{% endif %} -{% for version, release in context.history.released.items() %} +{% endif %}{% endfor %}{% endfor %}{% endif -%} +{% for version, release in context.history.released.items() -%} {# RELEASED #} ## {{ version.as_semver_tag() }} ({{ release.tagged_date.strftime("%Y-%m-%d") }}) {% for type_, commits in release["elements"] | dictsort %}