Skip to content

Commit

Permalink
Update README to clarify pre_n handling with distance_to_latest_tag
Browse files Browse the repository at this point in the history
Revised the `parse` expression to exclude `pre_n` and updated `serialize` examples to use `distance_to_latest_tag` instead. Fixes #272
  • Loading branch information
coordt committed Dec 19, 2024
1 parent f92b768 commit c027879
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
(?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\.
(?P<patch>0|[1-9]\\d*)
(?:
- # dash separator for pre-release section
(?P<pre_l>[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

Expand Down

0 comments on commit c027879

Please sign in to comment.