-
Notifications
You must be signed in to change notification settings - Fork 15
Description
changelog-cli tries to determine the appropriate next version number for the project. But the changelog is never (?) the only place in the repo that stores the version number.
There's often a VERSION or a _version.py, setup.py etc. file that actually stores the machine-readable version number.
changelog-cli could be configured to update these locations at the same time, so all the copies of the version number stay consistent.
How could it work?
We could have a .changelog-cli config file in the root of the repo.
Inside, we could have a mapping of filepaths to regexes.
Each filepath would be a file that contains a version that needs updating, and the regex would tell changelog-cli where to find the version number within the filepath. Something like:
[Version Files]
src/changelog/_version.py: '__version__\s*=\s*(\S*)'
setup.py: 'version=(\S*)'In this example (using Python's configparser format) changelog-cli release would not only modify the CHANGELOG, but also src/changelog/_version.py and setup.py. In each, it would use the regex to find the version. The contents of the "group 1" of each match would be replaced with the new version number.
The exact file format of the .changelog-cli file could be something that Python supports in the standard library (json or configparser), so there would be no additional dependencies needed and we wouldn't need to implement a new parser.
Another nice benefit of having a config file would be having a place to include other settings, like one for controlling the creation of a table of contents within the CHANGELOG (#14) (Although there are probably easier ways to do that).