From e7bdcb52496020b469aeccc41e8e2633e24b868a Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 1 Nov 2021 21:31:00 +0200 Subject: [PATCH] Setup release notes build using towncrier tool --- doc/newsfragments/README.md | 19 +++++++------ doc/release_notes/index.md | 4 +++ doc/release_notes/index.template.jinja | 37 ++++++++++++++++++++++++ towncrier.toml | 39 ++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 9 deletions(-) create mode 100644 doc/release_notes/index.md create mode 100644 doc/release_notes/index.template.jinja create mode 100644 towncrier.toml diff --git a/doc/newsfragments/README.md b/doc/newsfragments/README.md index a0ce3f33..0338cf80 100644 --- a/doc/newsfragments/README.md +++ b/doc/newsfragments/README.md @@ -1,12 +1,13 @@ -This is the directory for news snippets used by towncrier: https://github.com/twisted/towncrier +This is the directory for release note fragments processed by +[towncrier](https://github.com/hawkowl/towncrier). -When changing code in a way that's visible to an end user please make a new file in this directory. -It will be removed and integrated into release notes document upon a release of a new version of -Barrier. +When making a user-visible change create a file in this directory and it will be automatically be +included into the release note document when the next release is published. -towncrier has a few standard types of news fragments, signified by the file extension. These are: +The file extension specifies the type of a change. The following are currently supported: -.feature: Signifying a new feature. -.bugfix: Signifying a bug fix. -.doc: Signifying a documentation improvement. -.removal: Signifying a deprecation or removal of public API. + - .feature: a new feature. + - .bugfix: a bug fix. + - .security: a fix for security issue. + - .doc: a documentation improvement. + - .removal: a deprecation or removal of functionality. diff --git a/doc/release_notes/index.md b/doc/release_notes/index.md new file mode 100644 index 00000000..77dd565a --- /dev/null +++ b/doc/release_notes/index.md @@ -0,0 +1,4 @@ +Release notes +============= + +[comment]: <> (towncrier release notes start) diff --git a/doc/release_notes/index.template.jinja b/doc/release_notes/index.template.jinja new file mode 100644 index 00000000..418a1d32 --- /dev/null +++ b/doc/release_notes/index.template.jinja @@ -0,0 +1,37 @@ +{% 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 }} + +{% if definitions[category]['showcontent'] %} +{% for text, values in sections[section][category]|dictsort(by='value') %} +- {{ text }} +{% endfor %} +{% else %} +- {{ sections[section][category]['']|sort|join(', ') }} + + +{% endif %} +{% if sections[section][category]|length == 0 %} + +No significant changes. + + +{% else %} +{% endif %} +{% endfor %} +{% else %} + +No significant changes. + + +{% endif %} +{% endfor %} diff --git a/towncrier.toml b/towncrier.toml new file mode 100644 index 00000000..d8f0a61c --- /dev/null +++ b/towncrier.toml @@ -0,0 +1,39 @@ +[tool.towncrier] + package = "" + directory = "doc/newsfragments" + filename = "doc/release_notes/index.md" + template = "doc/release_notes/index.template.jinja" + title_format = "\nBarrier `{version}` ( `{project_date}` )\n================================\n" + start_string = "[comment]: <> (towncrier release notes start)" + [[tool.towncrier.section]] + path = "" + + [[tool.towncrier.type]] + directory = "security" + name = "Security fixes" + showcontent = false + + [[tool.towncrier.type]] + directory = "feature" + name = "Features" + 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 = "Miscellaneous" + showcontent = false