Skip to content

Commit b074de4

Browse files
Merge pull request #23 from brainelectronics/feature/use-changelog-snippets
Use changelog snippets
2 parents 039d012 + d0638eb commit b074de4

11 files changed

Lines changed: 100 additions & 32 deletions

File tree

.github/workflows/release.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,23 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
22+
with:
23+
# all history is needed to crawl it properly
24+
fetch-depth: 0
2225
- name: Set up Python
23-
uses: actions/setup-python@v3
26+
uses: actions/setup-python@v5
2427
with:
25-
python-version: '3.9'
28+
python-version: '3.11'
2629
- name: Install build dependencies
2730
run: |
2831
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
32+
- name: Update changelog with snippets
33+
run: |
34+
changelog-generator \
35+
changelog changelog.md \
36+
--snippets=.snippets \
37+
--in-place
2938
- name: Build package
3039
run: |
3140
changelog2version \

.github/workflows/test-release.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,23 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
19+
with:
20+
# all history is needed to crawl it properly
21+
fetch-depth: 0
1922
- name: Set up Python
20-
uses: actions/setup-python@v3
23+
uses: actions/setup-python@v5
2124
with:
22-
python-version: '3.9'
25+
python-version: '3.11'
2326
- name: Install build dependencies
2427
run: |
2528
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 \
34+
--in-place
2635
- name: Build package
2736
run: |
2837
changelog2version \

.github/workflows/test.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Checkout
29-
uses: actions/checkout@v3
29+
uses: actions/checkout@v4
30+
with:
31+
# all history is needed to crawl it properly
32+
fetch-depth: 0
3033
- name: Set up Python
31-
uses: actions/setup-python@v3
34+
uses: actions/setup-python@v5
3235
with:
33-
python-version: '3.9'
36+
python-version: '3.11'
3437
- name: Install test dependencies
3538
run: |
3639
pip install -r requirements-test.txt
@@ -40,6 +43,12 @@ jobs:
4043
- name: Lint with yamllint
4144
run: |
4245
yamllint .
46+
- name: Update changelog with snippets
47+
run: |
48+
changelog-generator \
49+
changelog changelog.md \
50+
--snippets=.snippets \
51+
--in-place
4352
- name: Validate package version file
4453
# the package version file has to be always up to date as mip is using
4554
# the file directly from the repo. On a PyPi package the version file

.github/workflows/unittest.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
test-and-coverage:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
18-
- uses: actions/setup-python@v3
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v5
1919
with:
20-
python-version: '3.9'
20+
python-version: '3.11'
2121
- name: Execute tests
2222
run: |
2323
pip install -r requirements-test.txt

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# snippets2changelog specific
2+
changelog.md
3+
changelog.md.new
4+
15
# custom, package specific ignores
26
.DS_Store
37
.DS_Store?

.snippets/22.md

Lines changed: 12 additions & 0 deletions
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)

be_upy_blink/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
22
# -*- coding: UTF-8 -*-
33

4-
__version_info__ = ("0", "9", "0")
4+
__version_info__ = ("0", "10", "0")
55
__version__ = '.'.join(__version_info__)

docs/CONTRIBUTING.md

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -107,29 +107,52 @@ 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 --in-place
150+
```
151+
152+
*Be aware to restore the changelog before another run as it might generate
153+
version entries and version bumps multiple times otherwise.*
154+
155+
### Version file
133156

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
]
1515
],
1616
"deps": [],
17-
"version": "0.9.0"
17+
"version": "0.10.0"
1818
}

requirements-deploy.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# List external packages here
22
# Avoid fixed versions
33
# # to upload package to PyPi or other package hosts
4-
twine>=4.0.1,<5
4+
twine>=5.1.1,<6
55
changelog2version>=0.5.0,<1
6+
snippets2changelog>=1.1.0,<2

0 commit comments

Comments
 (0)