Versioning unsupported files
Want to bump the version of a file that isn’t natively supported? Request it as a feature so it can be added to Knope’s built-in support! In the meantime, you have a couple options:
Using regex patterns
Section titled “Using regex patterns”Knope can update the version of any file using regex patterns:
[package]versioned_files = [ { path = "README.md", regex = "v(?<version>\\d+\\.\\d+\\.\\d+)" }]The regex pattern must include a named capture group (?<version>...) around the version number you want to replace. See the Text files with regex patterns section for more details.
Using a custom script
Section titled “Using a custom script”You can write a script to manually bump that file with the version produced by BumpVersion or PrepareRelease using a Command step, like this:
[package]versioned_files = [] # With no versioned_files, the version will be determined via Git tagchangelog = "CHANGELOG.md"
[[workflows]]name = "release"
[[workflows.steps]]type = "PrepareRelease"
[[workflows.steps]]type = "Command"command = "my-command-which-bumps-a-custom-file-with $version"Version a custom script
Section titled “Version a custom script”For more advanced cases, you can combine the regex feature with a Command step:
version = "1.2.3"
# ... do custom things with the version[package]versioned_files = [ { path = "custom-steps.py", regex = 'version = \"(?<version>.*)\"' }]
[[workflows]]name = "release"
[[workflows.steps]]# This updates the version in `custom-steps.py`type = "PrepareRelease"
[[workflows.steps]]type = "Command"command = "python custom-steps.py"