-
Notifications
You must be signed in to change notification settings - Fork 255
How to generate a CHANGELOG like version 7 and below? #982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I had a similar situation (and in fact, I added some of the behavior in 7.x). But the meat of what I'm doing is like this... would be nice if there were a slightly less messy way to handle the scopes.
Someone more adept at Jinja than me could probably also write little macros / functions that can be shared between the changelog / release notes, and reused within templates, to make it a little more readable. |
Thank you! I couldn't see you templates but I have downloaded this CHANGELOG.angular.md.j2 and with that the CHANGELOG looks better already (the md preview is good but the actual md file is badly formatted with huge spaces between lines, don't know why). Anyway, one other behaviour that I would like to understand is this: The npm library of semantic-release generates the CHANGELOG based on the branch I am in. So if I am in main, it is going to generate a CHANGELOG based only on full releases. This creates a very clean file with only full releases. In case of the python semantic-release library, this generates a single CHANGELOG and puts all the prereleases and full releases together (you can see that in the second example on the OP). Basically, when I do a full release I will NOT have a list of changes for the full version (let's say 1.2.0), but I will have a long list of prereleases (1.2.0-rc1, rc2 etc) and for each the changes of that particular prereleases. Then at the top I will just have the title ## v1.2.0 (2024-07-18), wrapping all the prereleases together. I would like to have a CHANGELOG like my first example when I am in main. I do not want to see any prerelease, just list all the changes since the last full release! |
@GiamBoscaro, yes, I agree, I have fix in the works to improve the issue with prereleases all being inside of the full changelog. Thank you for your description of you desired outcome. |
Thank you! There is also some other things that are different from npm semantic- release. I do not know if it is the right place to talk about this, but I have seen that any prerelease from any branch is considered the same prerelease during versioning. What I mean is: |
Yes, this is a bug discussed in #789. |
That file from my PR was a draft. Obviously I hadn't finished the spacing created by my attempt to make it more readable with syntax formatting. I recently found out that you can use a hyphen at the end of a closure ( |
Sure I know it is a draft. No complaint. The md rendering is good enough for me at the moment. |
Hi, had the same problem got the spaces removed, heres my current # CHANGELOG
{% if context.history.unreleased | length > 0 %}
## Unreleased
{% for type_, commits in context.history.unreleased | dictsort if type_ != "unknown" -%}
### {{ type_ | capitalize }}
{%- for commit in commits if type_ != "unknown" %}
{% if commit.scope -%}
- **{{ commit.scope }}**: {{ commit.descriptions[0] }} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
{% else -%}
- {{ commit.descriptions[0] | capitalize }} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
{% endif %}
{%- if commit.descriptions | length > 1 %}
{%- for description in commit.descriptions[1:] %}
- {{ description }}
{%- endfor %}
{%- endif %}
{%- if commit.breaking_descriptions | length > 0 %}
**BREAKING CHANGES:** {{ commit.breaking_descriptions | join(" ") }}
{%- endif %}
{%- endfor %}
{% endfor %}
{% endif %}
{% for version, release in context.history.released.items() -%}
## {{ version.as_semver_tag() }} ({{ release.tagged_date.strftime("%Y-%m-%d") }})
{%- for type_, commits in release["elements"] | dictsort if type_ != "unknown" %}
### {{ type_ | capitalize }}
{%- for commit in commits if type_ != "unknown" %}
{% if commit.scope -%}
- **{{ commit.scope }}**: {{ commit.descriptions[0] }} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
{% else -%}
- {{ commit.descriptions[0] | capitalize }} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
{% endif %}
{%- if commit.descriptions | length > 1 %}
{%- for description in commit.descriptions[1:] %}
- {{ description }}
{%- endfor %}
{%- endif %}
{%- if commit.breaking_descriptions | length > 0 %}
**BREAKING CHANGES:** {{ commit.breaking_descriptions | join(" ") }}
{%- endif %}
{%- endfor %}
{% endfor %}
{%- if "breaking" in release["elements"] %}
### BREAKING CHANGES
{%- for type_, commits in release["elements"] | dictsort if type_ == "breaking" %}
{%- for commit in commits %}
{% if commit.breaking_descriptions | length > 0 -%}
{% if commit.scope -%}
- **{{ commit.scope }}**: {{ commit.breaking_descriptions | join("\n\n") | capitalize }}
{% else -%}
- {{ commit.breaking_descriptions | join("\n\n") | capitalize }}
{% endif %}
{% endif %}
{%- endfor %}
{%- endfor %}
{% endif %}
{% endfor %}
|
I have upgraded my libraries and upgrade semantic-release to the latest version 9.8.5. I was coming from version 7 before.
Everything is working correctly after some tweaks, but the CHANGELOG generation is much worse than before in my opinion. Any suggestion on how to improve this?
Example:
Old CHANGELOG
Paragraphs based on commit (feat, fix, docs etc)
Module in Bold (core, auth, users)
One long list of changes for every version
New CHANGELOG:
Paragraphs based on commit (feat, fix, docs etc)
Module are not in bold (core, auth, users)
Mixed up pre releases with full releases, very confused
The text was updated successfully, but these errors were encountered: