-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docs for automatin rules #6072
Changes from 1 commit
08130bf
cd6bb83
e9f18f5
56258f8
c6cc05a
5361c0e
5b09c63
acf3dcc
25bc3c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
Automation Rules | ||
================ | ||
|
||
By default when new versions are created, | ||
they are not activated. | ||
So, when a new tag or branch is pushed to your repository, | ||
you need to log in your Read the Docs account to activate it or | ||
do other type of actions over that version. | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
To help to automate this tasks you can create an automation rule. | ||
|
||
#. Go to your project :guilabel:`Admin` > :guilabel:`Automation Rules` | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#. Click on "Add Rule" button | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#. Fill in the fields | ||
|
||
- Description: A description of what the rule does | ||
- Match: What versions the rule should be applied to | ||
- Version type: What type of versions the rule should be applied to | ||
- Action: What action should be applied to matching rules | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#. Click "Save" | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Match | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
----- | ||
|
||
New versions are matched against the type of match you chose: | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- **All versions**: All new versions. | ||
- **SemVer versions**: All new versions that follow `semantic versioning <https://semver.org/>`__. | ||
- **Custom match**: If none of the above rules match your use case, | ||
you can write a regular expression. | ||
|
||
Custom match | ||
~~~~~~~~~~~~ | ||
|
||
The custom match should be a valid `Python regular expression <https://docs.python.org/3/library/re.html>`__. | ||
Each new version is going to be tested against this regular expression, | ||
if it matches the corresponding action is executed against that version. | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Actions | ||
------- | ||
|
||
Currently we only support the following actions: | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- **Activate version on match**: It activates and builds the version. | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- **Set as default version on match**: It activates and builds the version too. | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Additionally, it sets the version as default, | ||
i.e. the version of your project that `/` redirects to. | ||
See more in :ref:`automatic-redirects:Root URL`. | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.. note:: | ||
|
||
If your versions follow :pep:`440`, | ||
Read the Docs activates and builds the version if it's greater than the current stable version. | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
See more in :doc:`versions`. | ||
|
||
Order | ||
----- | ||
|
||
The order your rules are listed in :guilabel:`Admin` > :guilabel:`Automation Rules` matters. | ||
Each action will be executed in that order, | ||
so first rules have a higher priority. | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
You can change the order using the up and down arrow buttons. | ||
|
||
.. note:: | ||
|
||
All actions of the rules that the version matches will be executed over that version. | ||
|
||
Examples | ||
-------- | ||
|
||
Activate all new tags | ||
~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
- Match: ``All versions`` | ||
- Version type: ``Tag`` | ||
- Action: ``Activate version on match`` | ||
|
||
Activate only new branches that belong to the ``1.x`` release | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
- Custom match: ``^1\.\d+$`` | ||
- Version type: ``Branch`` | ||
- Action: ``Activate version on match`` | ||
|
||
Set as default new tags that have the ``-stable`` or ``-release`` suffix | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
- Custom match: ``-(stable)|(release)$`` | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- Version type: ``Branch`` | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- Action: ``Set as default version on match`` | ||
|
||
.. note:: | ||
|
||
You can also create two rules, one to match ``-stable`` and | ||
other to match ``-release``. | ||
|
||
Activate all new tags and branches that start with ``v`` or ``V`` | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
- Custom match: ``^[vV]`` | ||
- Version type: ``Tag`` | ||
- Action: ``Activate version on match`` | ||
|
||
|
||
- Custom match: ``^[vV]`` | ||
- Version type: ``Branch`` | ||
- Action: ``Activate version on match`` | ||
|
||
Activate all new tags that don't contain the ``-nightly`` suffix | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is a very common case, we can add new actions like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or an option for the rule like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would remove this example from the docs for now. Looks pretty complex to me and I'm not sure how many cases there are where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The section is supposed to have complex examples, more than the suffix, is to have an example of how apply a rule on not-match There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm suggesting #6354 to make this more easy |
||
|
||
- Custom match: ``.*(?<!-nightly)$`` | ||
- Version type: ``Tag`` | ||
- Action: ``Activate version on match`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes
make livehtml
to fail