Skip to content

Commit 647b10b

Browse files
authored
Clarify support for an optional v-prefix in branch and tag names (#11712)
* Clarify support for an optional v-prefix in branch and tag names * Add info about v-prefix in automation rules docs
1 parent d307de2 commit 647b10b

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

docs/user/automation-rules.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ Predefined matches
4646
Automation rules support two predefined version matches:
4747

4848
- **Any version**: All new versions will match the rule.
49-
- **SemVer versions**: All new versions that follow `semantic versioning <https://semver.org/>`__ will match the rule.
49+
- **SemVer versions**: All new versions that follow `semantic versioning <https://semver.org/>`__
50+
(with or without a `v` prefix) will match the rule.
5051

5152
Custom matches
5253
~~~~~~~~~~~~~~

docs/user/versions.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ During initial setup, Read the Docs also creates a ``latest`` version
1919
that points to the default branch defined in your Git repository (usually ``main``).
2020
This version should always exist and is the default version for your project.
2121

22-
If your project has any tags or branches with a name following `semantic versioning <https://semver.org/>`_,
22+
If your project has any tags or branches with a name following
23+
`semantic versioning <https://semver.org/>`_ (with or without a ``v`` prefix),
2324
we also create a ``stable`` version tracking your most recent release.
2425
If you want a custom ``stable`` version,
2526
create either a tag or branch in your project with that name.
@@ -135,6 +136,7 @@ all of which can be reconfigured if necessary:
135136

136137
Semantic versioning allows "normal" version numbers like ``1.4.2``, as
137138
well as pre-releases like this: ``2.0a1``. The ``stable`` version of your documentation never includes a pre-release.
139+
An optional ``v`` prefix like ``v1.4.2`` or ``v2.0a1`` is also allowed.
138140

139141
- Branches are assumed to be **long-lived branches**,
140142
This is most useful for **release branches**, which are maintained over time for a specific release.

readthedocs/builds/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@
130130

131131
# Pattern referred from
132132
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
133+
# without naming the capturing groups and with the addition of
134+
# allowing an optional "v" prefix.
133135
SEMVER_VERSIONS_REGEX = r"^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" # noqa
134136

135137

0 commit comments

Comments
 (0)