Giter Site home page Giter Site logo

Comments (3)

ibiscp avatar ibiscp commented on June 4, 2024 1

@codejedi365 For anyone looking for the same thing.

.release_notes.md.j2

{% set emoji_map = {
    'breaking': 'šŸ’„',
    'feature': 'āœØ',
    'fix': 'šŸ›',
    'performance': 'āš”',
    'refactor': 'ā™»ļø',
    'chore': 'šŸš€',
    'documentation': 'šŸ“–',
    'test': 'āœ…',
    'ci': 'šŸ¤–',
    'style': 'šŸŽØ',
    'build': 'šŸ—',
    'unknown': 'ā—',
} %}

{% macro commit_scope(commit_summary) %}{{ commit_summary.split(":")[0] }}{% endmacro %}
{% macro commit_content(commit_summary) %}{{ commit_summary.split(":")[1] }}{% endmacro %}
{% set order = emoji_map.keys() %}

## {{ version.as_tag() }} ({{ release.tagged_date.strftime("%Y-%m-%d") }})
{%- for type_ in order %}
{%- if type_ in release["elements"] %}
### {{ emoji_map[type_] }} {{ type_ | capitalize }}
{% for commit in release["elements"][type_] %}
{%- set scope = commit_scope(commit.commit.summary).split("(")[1] | replace(")", "") | default ("", true) %}
- {% if scope %}\[**{{ scope }}**\]{%endif%}{{ commit_content(commit.commit.summary) }} [\@{{ commit.commit.author.name }}](mailto:{{commit.commit.author.email}})
{%- endfor %}
{% endif %}
{% endfor %}

CHANGELOG.md.j2

{% set emoji_map = {
    'breaking': 'šŸ’„',
    'feature': 'āœØ',
    'fix': 'šŸ›',
    'performance': 'āš”',
    'refactor': 'ā™»ļø',
    'chore': 'šŸš€',
    'documentation': 'šŸ“–',
    'test': 'āœ…',
    'ci': 'šŸ¤–',
    'style': 'šŸŽØ',
    'build': 'šŸ—',
    'unknown': 'ā—',
} %}

{% macro commit_scope(commit_summary) %}{{ commit_summary.split(":")[0] }}{% endmacro %}
{% macro commit_content(commit_summary) %}{{ commit_summary.split(":")[1] }}{% endmacro %}
{% set order = emoji_map.keys() %}

# CHANGELOG
{% if context.history.unreleased | length > 0 %}

{# UNRELEASED #}
## Unreleased
{%- for type_ in order %}
{%- if type_ in context.history.unreleased %}
### {{ emoji_map[type_] }} {{ type_ | capitalize }}
{% for commit in context.history.unreleased[type_] %}
{% set scope = commit_scope(commit.commit.summary).split("(")[1] | replace(")", "") | default ("", true) %}
- {% if scope %}\[**{{ scope }}**\]{%endif%}{{ commit_content(commit.commit.summary) }} [\@{{ commit.commit.author.name }}](mailto:{{commit.commit.author.email}})
{% endfor %}{% endif %}{% endfor %}{% endif %}

{# RELEASED #}
{% for version, release in context.history.released.items() %}
## {{ version.as_tag() }} ({{ release.tagged_date.strftime("%Y-%m-%d") }})
{%- for type_ in order %}
{%- if type_ in release["elements"] %}
### {{ emoji_map[type_] }} {{ type_ | capitalize }}
{% for commit in release["elements"][type_] %}
{% set scope = commit_scope(commit.commit.summary).split("(")[1] | replace(")", "") | default ("", true) %}
- {% if scope %}\[**{{ scope }}**\]{%endif%}{{ commit_content(commit.commit.summary) }} [\@{{ commit.commit.author.name }}](mailto:{{commit.commit.author.email}})
{% endfor %}{% endif %}{% endfor %}{% endfor %}

from python-semantic-release.

codejedi365 avatar codejedi365 commented on June 4, 2024

@ibiscp I'll let you decide if it is easy or not, but to do what you desire, you can provide your own template directory instead with a modified jinja template for both your release notes and changelog.

You will need to create a complex if statement to match the desired emoji to the commit types. Or you might be able to write a jinja macro for this.

I would first start with the embedded templates and then modify them accordingly. There is a page in the docs to describe the file structure of the templates directory.

from python-semantic-release.

codejedi365 avatar codejedi365 commented on June 4, 2024

@ibiscp, that's solid! Thanks for posting!

from python-semantic-release.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.