From c0278791fad3de1c3d66ab06b49118b2b8314933 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Thu, 19 Dec 2024 13:20:19 -0600 Subject: [PATCH] Update README to clarify pre_n handling with distance_to_latest_tag Revised the `parse` expression to exclude `pre_n` and updated `serialize` examples to use `distance_to_latest_tag` instead. Fixes #272 --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fa087e71..8e7f5b05 100644 --- a/README.md +++ b/README.md @@ -182,13 +182,24 @@ The full development and release path is: The `pre_n` or pre-release number is a number that increases with each pre-release. You can automate this by changing the serialization configuration. ```toml title="Serialize configuration with pre_n automation" +parse = """(?x) + (?P0|[1-9]\\d*)\\. + (?P0|[1-9]\\d*)\\. + (?P0|[1-9]\\d*) + (?: + - # dash separator for pre-release section + (?P[a-zA-Z-]+) # pre-release label + (?:0|[1-9]\\d*) # pre-release version number + )? # pre-release section is optional +""" + serialize = [ "{major}.{minor}.{patch}-{pre_l}{distance_to_latest_tag}", "{major}.{minor}.{patch}", ] ``` -The `distance_to_latest_tag` is a special value that is replaced with the number of commits since the last tag. This is a good value to use for the `pre_n` because it will always increase with each commit. +Now the `pre_n` is no longer captured in the `parse` expression and `serialize` replaces `pre_n` with `distance_to_latest_tag`. The `distance_to_latest_tag` is a special value replaced with the number of commits since the last tag. This is a good value to use for the `pre_n` because it will always increase with each commit. ### Visualize the pre_n versioning path