Comments (3)
@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.
@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.
@ibiscp, that's solid! Thanks for posting!
from python-semantic-release.
Related Issues (20)
- Why is in every example git config for user.email and user.name set? HOT 1
- version_variables not working HOT 2
- How to get the program to analyse all the previous commits and increase the version number in a cumulative way HOT 9
- All pre-release changelog on release. HOT 6
- GitHub Actions can't create release: `ValueError: release id for tag <tag> not found, and could not be created` HOT 4
- BREAKING CHANGE does not appear to cause major version bump HOT 4
- How to pre-release in all other branch. HOT 2
- Github release creation fails with "Error: Unauthorized" despite GH_TOKEN HOT 6
- v10.0.0
- CLI option to check and fix incorrect commit messages HOT 1
- AttributeError: 'TOMLDocument' object has no attribute 'unwrap' HOT 1
- Implement CLI option to base versioning on latest tag only HOT 3
- configure changelog.md.j2 to have only final releases in the generated changelog.md HOT 3
- multibranch release version incorrectly incremented HOT 4
- Help not shown if semantic-release not configured HOT 2
- GitHub action raises stderr: 'error: src refspec main matches more than one HOT 3
- multibranch releases convert semver version to pep440 version HOT 2
- Relative template_dir path causes TemplateNotFound error in monorepo configuration HOT 3
- Updating version_variables that follow tag_format HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-semantic-release.