diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 93e60c8..ee159f4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,14 +18,23 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + # all history is needed to crawl it properly + fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: - python-version: '3.9' + python-version: '3.11' - name: Install build dependencies run: | if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi + - name: Update changelog with snippets + run: | + changelog-generator \ + changelog changelog.md \ + --snippets=.snippets \ + --in-place - name: Build package run: | changelog2version \ diff --git a/.github/workflows/test-release.yaml b/.github/workflows/test-release.yaml index 214ecc7..4683458 100644 --- a/.github/workflows/test-release.yaml +++ b/.github/workflows/test-release.yaml @@ -15,14 +15,23 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + # all history is needed to crawl it properly + fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: - python-version: '3.9' + python-version: '3.11' - name: Install build dependencies run: | if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi + - name: Update changelog with snippets + run: | + changelog-generator \ + changelog changelog.md \ + --snippets=.snippets \ + --in-place - name: Build package run: | changelog2version \ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 46f6493..44b8602 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,11 +26,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + # all history is needed to crawl it properly + fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: - python-version: '3.9' + python-version: '3.11' - name: Install test dependencies run: | pip install -r requirements-test.txt @@ -40,6 +43,12 @@ jobs: - name: Lint with yamllint run: | yamllint . + - name: Update changelog with snippets + run: | + changelog-generator \ + changelog changelog.md \ + --snippets=.snippets \ + --in-place - name: Validate package version file # the package version file has to be always up to date as mip is using # the file directly from the repo. On a PyPi package the version file diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml index 7021275..e78db31 100644 --- a/.github/workflows/unittest.yaml +++ b/.github/workflows/unittest.yaml @@ -14,10 +14,10 @@ jobs: test-and-coverage: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: '3.9' + python-version: '3.11' - name: Execute tests run: | pip install -r requirements-test.txt diff --git a/.gitignore b/.gitignore index ada7b4e..1a8f6f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# snippets2changelog specific +changelog.md +changelog.md.new + # custom, package specific ignores .DS_Store .DS_Store? diff --git a/.snippets/22.md b/.snippets/22.md new file mode 100644 index 0000000..4984b45 --- /dev/null +++ b/.snippets/22.md @@ -0,0 +1,12 @@ +## Use changelog snippets + + +This change replaces the modifications and extensions of a changelog by +generating the changelog with all its entries and versions based on changelog +snippets like this one. + +This closes [#22](https://github.com/brainelectronics/micropython-package-template/issues/22) diff --git a/be_upy_blink/version.py b/be_upy_blink/version.py index a38aa51..eecf8a9 100644 --- a/be_upy_blink/version.py +++ b/be_upy_blink/version.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 # -*- coding: UTF-8 -*- -__version_info__ = ("0", "9", "0") +__version_info__ = ("0", "10", "0") __version__ = '.'.join(__version_info__) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 1e411a6..90aed94 100755 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -107,29 +107,52 @@ pre-commit run --all-files The changelog format is based on [Keep a Changelog][ref-keep-a-changelog], and this project adheres to [Semantic Versioning][ref-semantic-versioning]. -Please add a changelog entry for every PR you contribute. The versions are -seperated into `MAJOR.MINOR.PATCH`: - -- Increment the major version by 1 in case you created a breaking, non -backwards compatible change which requires the user to perform additional -tasks, adopt his currently running code or in general can't be used as is anymore. -- Increment the minor version by 1 on new "features" which can be used or are -optional, but in either case do not require any changes by the user to keep -the system running after upgrading. -- Increment the patch version by 1 on bugfixes which fix an issue but can be -used out of the box, like features, without any changes by the user. In some -cases bugfixes can be breaking changes of course. - -Please add the date the change has been made as well to the changelog -following the format `## [MAJOR.MINOR.PATCH] - YYYY-MM-DD`. It is not -necessary to keep this date up to date, it is just used as meta data. +### General + +Please add a changelog snippet for every PR you contribute. The changes are +categorised into: + +- `bugfixes` fix an issue which can be used out of the box without any further +changes required by the user. Be aware that in some cases bugfixes can be +breaking changes. +- `features` is used to indicate a backwards compatible change providing +improved or extended functionalitiy. This does, as `bugfixes`, in any case +not require any changes by the user to keep the system running after upgrading. +- `breaking` creates a breaking, non backwards compatible change which +requires the user to perform additional tasks, adopt his currently running +code or in general can't be used as is anymore. The changelog entry shall be short but meaningful and can of course contain links and references to other issues or PRs. New lines are only allowed for a new bulletpoint entry. Usage examples or other code snippets should be placed in the code documentation, README or the docs folder. -### General +### Creation + +To create a new changelog snippet use the CLI tool with its simple interface. +Use the issue number, in this example `22.md`, as the snippet name. The +extension shall always be `.md`. + +```bash +changelog-generator create .snippets/22.md +``` + +The tool will create a basic snippet which can and should be extended with a +detailed description of the change after the file creation. + +### Generation + +Commit the changes and the snippet file and run the following command to create +a changelog with the latest snippet included + +```bash +changelog-generator changelog changelog.md --snippets=.snippets --in-place +``` + +*Be aware to restore the changelog before another run as it might generate +version entries and version bumps multiple times otherwise.* + +### Version file The package version file, located at `/version.py` contains the latest changelog version. diff --git a/package.json b/package.json index c32bebc..afefb7b 100644 --- a/package.json +++ b/package.json @@ -14,5 +14,5 @@ ] ], "deps": [], - "version": "0.9.0" + "version": "0.10.0" } \ No newline at end of file diff --git a/requirements-deploy.txt b/requirements-deploy.txt index 96b0350..38eeeaa 100644 --- a/requirements-deploy.txt +++ b/requirements-deploy.txt @@ -1,5 +1,6 @@ # List external packages here # Avoid fixed versions # # to upload package to PyPi or other package hosts -twine>=4.0.1,<5 +twine>=5.1.1,<6 changelog2version>=0.5.0,<1 +snippets2changelog>=1.1.0,<2 diff --git a/requirements-test.txt b/requirements-test.txt index 2ac46f6..369a64f 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -5,5 +5,6 @@ coverage>=6.4.2,<7 flake8>=5.0.0,<6 nose2>=0.12.0,<1 setup2upypackage>=0.4.0,<1 +snippets2changelog>=1.1.0,<2 pre-commit>=3.3.3,<4 yamllint>=1.29,<2