From cbb0cab8144d8fe7c2a01f0283dd89b99275fd43 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Tue, 7 Jan 2025 21:06:43 +0200 Subject: [PATCH] scripts: Add script to create release notes Signed-off-by: Povilas Kanapickas --- pyproject.toml | 40 ++++++++++++++++++++++++++++++++ scripts/Changelog-template.jinja | 33 ++++++++++++++++++++++++++ scripts/make_release_notes.sh | 14 +++++++++++ 3 files changed, 87 insertions(+) create mode 100644 scripts/Changelog-template.jinja create mode 100755 scripts/make_release_notes.sh diff --git a/pyproject.toml b/pyproject.toml index b6a8360..282edfb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,3 +13,43 @@ force-single-line = true [tool.ruff.format] preview = true # needed for quote-style quote-style = "preserve" + +[tool.towncrier] + package = "podman_compose" + package_dir = "master" + directory = "newsfragments" + filename = "docs/Changelog-new.md" + template = "scripts/Changelog-template.jinja" + title_format = "Version {version} ({project_date})" + [[tool.towncrier.section]] + path = "" + + [[tool.towncrier.type]] + directory = "feature" + name = "Features" + showcontent = true + + [[tool.towncrier.type]] + directory = "change" + name = "Changes" + showcontent = true + + [[tool.towncrier.type]] + directory = "bugfix" + name = "Bug fixes" + showcontent = true + + [[tool.towncrier.type]] + directory = "doc" + name = "Improved Documentation" + showcontent = true + + [[tool.towncrier.type]] + directory = "removal" + name = "Deprecations and Removals" + showcontent = true + + [[tool.towncrier.type]] + directory = "misc" + name = "Misc" + showcontent = true diff --git a/scripts/Changelog-template.jinja b/scripts/Changelog-template.jinja new file mode 100644 index 0000000..531adc6 --- /dev/null +++ b/scripts/Changelog-template.jinja @@ -0,0 +1,33 @@ +{% for section, _ in sections|dictsort(by='key') %} +{% set underline = "-" %} +{% if section %} +{{section}} +{{ underline * section|length }}{% set underline = "~" %} + +{% endif %} +{% if sections[section] %} +{% for category, val in definitions|dictsort if category in sections[section]%} + +{{ definitions[category]['name'] }} +{{ underline * definitions[category]['name']|length }} + +{% for text, values in sections[section][category]|dictsort(by='value') %} +- {{ text }} +{% endfor %} + +{% if sections[section][category]|length == 0 %} + +No significant changes. + + +{% else %} +{% endif %} +{% endfor %} +{% else %} + +No significant changes. + + +{% endif %} +{% endfor %} +(venv) p12@exec-desktop:~/cod diff --git a/scripts/make_release_notes.sh b/scripts/make_release_notes.sh new file mode 100755 index 0000000..302161b --- /dev/null +++ b/scripts/make_release_notes.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +if [ $# -ne 1 ]; then + echo "Usage: make_release_notes.sh VERSION" + exit 1 +fi + +VERSION=$1 +towncrier build --version "$VERSION" --yes +git mv "docs/Changelog-new.md" "docs/Changelog-$VERSION.md" +git add "newsfragments/" +git commit -m "Release notes for $VERSION"