Skip to content

Commit 100458f

Browse files
introduce snippet based changelog
1 parent 039d012 commit 100458f

File tree

7 files changed

+74
-23
lines changed

7 files changed

+74
-23
lines changed

.github/workflows/release.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,15 @@ jobs:
2626
- name: Install build dependencies
2727
run: |
2828
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
29+
- name: Update changelog with snippets
30+
run: |
31+
changelog-generator \
32+
changelog changelog.md \
33+
--snippets=.snippets
2934
- name: Build package
3035
run: |
3136
changelog2version \
32-
--changelog_file changelog.md \
37+
--changelog_file changelog.md.new \
3338
--version_file be_upy_blink/version.py \
3439
--version_file_type py \
3540
--debug
@@ -49,7 +54,7 @@ jobs:
4954
# note you'll typically need to create a personal access token
5055
# with permissions to create releases in the other repo
5156
# or you set the "contents" permissions to "write" as in this example
52-
changelog-path: changelog.md
57+
changelog-path: changelog.md.new
5358
tag-name-prefix: ''
5459
tag-name-extension: ''
5560
release-name-prefix: ''

.github/workflows/test-release.yaml

+7-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ jobs:
2323
- name: Install build dependencies
2424
run: |
2525
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
26+
- name: Update changelog with snippets
27+
run: |
28+
changelog-generator \
29+
changelog changelog.md \
30+
--snippets=.snippets
2631
- name: Build package
2732
run: |
2833
changelog2version \
29-
--changelog_file changelog.md \
34+
--changelog_file changelog.md.new \
3035
--version_file be_upy_blink/version.py \
3136
--version_file_type py \
3237
--additional_version_info="-rc${{ github.run_number }}.dev${{ github.event.number }}" \
@@ -60,7 +65,7 @@ jobs:
6065
# note you'll typically need to create a personal access token
6166
# with permissions to create releases in the other repo
6267
# or you set the "contents" permissions to "write" as in this example
63-
changelog-path: changelog.md
68+
changelog-path: changelog.md.new
6469
tag-name-prefix: ''
6570
tag-name-extension: '-rc${{ github.run_number }}.dev${{ github.event.number }}'
6671
release-name-prefix: ''

.github/workflows/test.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,18 @@ jobs:
4040
- name: Lint with yamllint
4141
run: |
4242
yamllint .
43+
- name: Update changelog with snippets
44+
run: |
45+
changelog-generator \
46+
changelog changelog.md \
47+
--snippets=.snippets
4348
- name: Validate package version file
4449
# the package version file has to be always up to date as mip is using
4550
# the file directly from the repo. On a PyPi package the version file
4651
# is updated and then packed
4752
run: |
4853
changelog2version \
49-
--changelog_file changelog.md \
54+
--changelog_file changelog.md.new \
5055
--version_file be_upy_blink/version.py \
5156
--version_file_type py \
5257
--validate \
@@ -55,7 +60,7 @@ jobs:
5560
run: |
5661
upy-package \
5762
--setup_file setup.py \
58-
--package_changelog_file changelog.md \
63+
--package_changelog_file changelog.md.new \
5964
--package_file package.json \
6065
--validate
6166
# use --ignore-version to skip version validation

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# snippets2changelog specific
2+
changelog.md.new
3+
14
# custom, package specific ignores
25
.DS_Store
36
.DS_Store?

.snippets/22.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Use changelog snippets
2+
<!--
3+
type: feature
4+
scope: all
5+
affected: all
6+
-->
7+
8+
This change replaces the modifications and extensions of a changelog by
9+
generating the changelog with all its entries and versions based on changelog
10+
snippets like this one.
11+
12+
This closes [#22](https://github.com/brainelectronics/micropython-package-template/issues/22)

docs/CONTRIBUTING.md

+37-17
Original file line numberDiff line numberDiff line change
@@ -107,29 +107,49 @@ pre-commit run --all-files
107107
The changelog format is based on [Keep a Changelog][ref-keep-a-changelog], and
108108
this project adheres to [Semantic Versioning][ref-semantic-versioning].
109109

110-
Please add a changelog entry for every PR you contribute. The versions are
111-
seperated into `MAJOR.MINOR.PATCH`:
112-
113-
- Increment the major version by 1 in case you created a breaking, non
114-
backwards compatible change which requires the user to perform additional
115-
tasks, adopt his currently running code or in general can't be used as is anymore.
116-
- Increment the minor version by 1 on new "features" which can be used or are
117-
optional, but in either case do not require any changes by the user to keep
118-
the system running after upgrading.
119-
- Increment the patch version by 1 on bugfixes which fix an issue but can be
120-
used out of the box, like features, without any changes by the user. In some
121-
cases bugfixes can be breaking changes of course.
122-
123-
Please add the date the change has been made as well to the changelog
124-
following the format `## [MAJOR.MINOR.PATCH] - YYYY-MM-DD`. It is not
125-
necessary to keep this date up to date, it is just used as meta data.
110+
### General
111+
112+
Please add a changelog snippet for every PR you contribute. The changes are
113+
categorised into:
114+
115+
- `Bugfixes` fix an issue which can be used out of the box without any further
116+
changes required by the user. Be aware that in some cases bugfixes can be
117+
breaking changes.
118+
- `features` is used to indicate a backwards compatible change providing
119+
improved or extended functionalitiy. This does, as `bugfixes`, in any case
120+
not require any changes by the user to keep the system running after upgrading.
121+
- `breaking` creates a breaking, non backwards compatible change which
122+
requires the user to perform additional tasks, adopt his currently running
123+
code or in general can't be used as is anymore.
126124

127125
The changelog entry shall be short but meaningful and can of course contain
128126
links and references to other issues or PRs. New lines are only allowed for a
129127
new bulletpoint entry. Usage examples or other code snippets should be placed
130128
in the code documentation, README or the docs folder.
131129

132-
### General
130+
### Creation
131+
132+
To create a new changelog snippet use the CLI tool with its simple interface.
133+
Use the issue number, in this example `22.md`, as the snippet name. The
134+
extension shall always be `.md`.
135+
136+
```bash
137+
changelog-generator create .snippets/22.md
138+
```
139+
140+
The tool will create a basic snippet which can and should be extended with a
141+
detailed description of the change after the file creation.
142+
143+
### Generation
144+
145+
Commit the changes and the snippet file and run the following command to create
146+
a changelog with the latest snippet included
147+
148+
```bash
149+
changelog-generator changelog changelog.md --snippets=.snippets
150+
```
151+
152+
### Version file
133153

134154
The package version file, located at `<PACKAGE_NAME>/version.py` contains the
135155
latest changelog version.

requirements-deploy.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
# # to upload package to PyPi or other package hosts
44
twine>=4.0.1,<5
55
changelog2version>=0.5.0,<1
6+
snippets2changelog>=1.0.3,<2

0 commit comments

Comments
 (0)