Skip to content

Commit

Permalink
Clarify support for an optional v-prefix in branch and tag names (#…
Browse files Browse the repository at this point in the history
…11712)

* Clarify support for an optional v-prefix in branch and tag names

* Add info about v-prefix in automation rules docs
  • Loading branch information
laymonage authored Oct 24, 2024
1 parent d307de2 commit 647b10b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/user/automation-rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ Predefined matches
Automation rules support two predefined version matches:

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

Custom matches
~~~~~~~~~~~~~~
Expand Down
4 changes: 3 additions & 1 deletion docs/user/versions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ During initial setup, Read the Docs also creates a ``latest`` version
that points to the default branch defined in your Git repository (usually ``main``).
This version should always exist and is the default version for your project.

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

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

- Branches are assumed to be **long-lived branches**,
This is most useful for **release branches**, which are maintained over time for a specific release.
Expand Down
2 changes: 2 additions & 0 deletions readthedocs/builds/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@

# Pattern referred from
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
# without naming the capturing groups and with the addition of
# allowing an optional "v" prefix.
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


Expand Down

0 comments on commit 647b10b

Please sign in to comment.