Skip to content

Commit c027879

Browse files
committed
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
1 parent f92b768 commit c027879

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,24 @@ The full development and release path is:
182182
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.
183183

184184
```toml title="Serialize configuration with pre_n automation"
185+
parse = """(?x)
186+
(?P<major>0|[1-9]\\d*)\\.
187+
(?P<minor>0|[1-9]\\d*)\\.
188+
(?P<patch>0|[1-9]\\d*)
189+
(?:
190+
- # dash separator for pre-release section
191+
(?P<pre_l>[a-zA-Z-]+) # pre-release label
192+
(?:0|[1-9]\\d*) # pre-release version number
193+
)? # pre-release section is optional
194+
"""
195+
185196
serialize = [
186197
"{major}.{minor}.{patch}-{pre_l}{distance_to_latest_tag}",
187198
"{major}.{minor}.{patch}",
188199
]
189200
```
190201

191-
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.
202+
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.
192203

193204
### Visualize the pre_n versioning path
194205

0 commit comments

Comments
 (0)