Skip to content
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

chore: set up towncrier for changelog management #861

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

<!-- towncrier release notes start -->

## [0.44.0](https://github.com/Substra/substra-backend/releases/tag/0.44.0) 2024-03-07

Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,22 @@ Install [pre-commit](https://pre-commit.com/), then run:
pre-commit install
```

## How to generate the changelog

The changelog is managed with [towncrier](https://towncrier.readthedocs.io/en/stable/index.html).
To add a new entry in the changelog, add a file in the `changes` folder. The file name should have the following structure:
`<unique_id>.<change_type>`.
The `unique_id` is a unique identifier, we currently use the PR number.
The `change_type` can be of the following types: `added`, `changed`, `removed`, `fixed`.

To generate the changelog (for example during a release), use the following command (you must have the dev dependencies installed):

```
towncrier build --version=<x.y.z>
```

You can use the `--draft` option to see what would be generated without actually writing to the changelog (and without removing the fragments).

## Companion repositories

The Substra platform is built from several components (see the [architecture](https://doc.substra.ai/architecture.html) documentation for a comprehensive overview):
Expand Down
3 changes: 2 additions & 1 deletion backend/dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ djangorestframework-stubs==1.8.0
django-stubs==1.14.0
celery-types==0.22.0
docker==6.1.3
celery[pytest]
celery[pytest]
towncrier==23.11.0
1 change: 1 addition & 0 deletions changes/861.changed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [chore] `towncrier` is now used for changelog management ([#861](https://github.com/Substra/substra-backend/pull/861))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to specify "chore" in the message ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(asking for my future self)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, the only thing that matters is the name of the file (has to end with .added, .fixed, .removed or .changed

you can put whatever you want inside the file, including nested multiline lists, code snippets...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay I see thx

12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,15 @@ exclude = [

[tool.django-stubs]
django_settings_module = "backend.settings.test"


[tool.towncrier]
directory = "changes"
filename = "CHANGELOG.md"
start_string = "<!-- towncrier release notes start -->\n"
underlines = ["", "", ""]
title_format = "## [{version}](https://github.com/Substra/substra-backend/releases/tag/{version}) - {project_date}"
[tool.towncrier.fragment.added]
[tool.towncrier.fragment.removed]
[tool.towncrier.fragment.changed]
[tool.towncrier.fragment.fixed]
Loading