Skip to content

Commit

Permalink
Merge pull request #5634 from MetRonnie/towncrier
Browse files Browse the repository at this point in the history
Use towncrier for changelog generation
  • Loading branch information
hjoliver authored Jul 26, 2023
2 parents ec8b01d + 73bcdcc commit ae24bef
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 11 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/1_create_release_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,14 @@ jobs:
init-file: 'cylc/flow/__init__.py'
pypi-package-name: 'cylc-flow'

- name: Update "released on" date in changelog
continue-on-error: true
uses: cylc/release-actions/stage-1/update-changelog-release-date@v1
with:
changelog-file: 'CHANGES.md'

- name: Test build
uses: cylc/release-actions/build-python-package@v1

- name: Generate changelog
run: |
python3 -m pip install -q towncrier
towncrier build --yes
- name: Create pull request
uses: cylc/release-actions/stage-1/create-release-pr@v1
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test_fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ jobs:
- name: Configure git # Needed by the odd test
uses: cylc/release-actions/configure-git@v1

- name: Check changelog
if: startsWith(matrix.os, 'ubuntu')
run: towncrier build --draft

- name: Style
if: startsWith(matrix.os, 'ubuntu')
run: |
Expand Down
11 changes: 6 additions & 5 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ List of notable changes, for a complete list of changes see the
[closed milestones](https://github.com/cylc/cylc-flow/milestones?state=closed)
for each release.

<!-- The topmost release date is automatically updated by GitHub Actions. When
creating a new release entry be sure to copy & paste the span tag with the
`actions:bind` attribute, which is used by a regex to find the text to be
updated. Only the first match gets replaced, so it's fine to leave the old
ones in. -->
<!--
NOTE: Do not add entries here, use towncrier fragments instead:
$ towncrier create <PR-number>.<break|feat|fix>.md --content "Short description"
-->

<!-- towncrier release notes start -->

## __cylc-8.2.0 (<span actions:bind='release-date'>Released 2023-07-21</span>)__

Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ Feel free to ask questions on the issue or
[developers chat](https://matrix.to/#/#cylc-general:matrix.org) if unsure about
anything.

We use [towncrier](https://towncrier.readthedocs.io/en/stable/index.html) for
generating the changelog. Changelog entries are added by running
```
towncrier create <PR-number>.<break|feat|fix>.md --content "Short description"
```

## Code Contributors

Expand Down
13 changes: 13 additions & 0 deletions changes.d/changelog-template.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% if sections[""] %}
{% for category, val in definitions.items() if category in sections[""] %}
### {{ definitions[category]['name'] }}

{% for text, pulls in sections[""][category].items() %}
{{ pulls|join(', ') }} - {{ text }}

{% endfor %}
{% endfor %}
{% else %}
No significant changes.

{% endif %}
23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[tool.towncrier]
directory = "changes.d"
name = "Cylc"
package = "cylc.flow"
filename = "CHANGES.md"
template = "changes.d/changelog-template.jinja"
underlines = ["", "", ""]
title_format = "## __cylc-{version} (Released {project_date})__"
issue_format = "[#{issue}](https://github.com/cylc/cylc-flow/pull/{issue})"

# These changelog sections will be shown in the defined order:
[[tool.towncrier.type]]
directory = "break" # NB this is just the filename not directory e.g. 123.break.md
name = "⚠ Breaking Changes"
showcontent = true
[[tool.towncrier.type]]
directory = "feat"
name = "🚀 Enhancements"
showcontent = true
[[tool.towncrier.type]]
directory = "fix"
name = "🔧 Fixes"
showcontent = true
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ tests =
pytest-mock>=3.6.1
pytest>=6
testfixtures>=6.11.0
towncrier>=23
# Type annotation stubs
# http://mypy-lang.blogspot.com/2021/05/the-upcoming-switch-to-modular-typeshed.html
types-Jinja2>=0.1.3
Expand Down

0 comments on commit ae24bef

Please sign in to comment.