Skip to content

Commit c0d1e17

Browse files
committed
Merge tag '3.10.0' into rel
2 parents d525ec1 + ff0ad67 commit c0d1e17

37 files changed

+1825
-141
lines changed

.github/workflows/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Trigger tests in corporate
15+
run: |
16+
curl --request POST \
17+
--silent --output /dev/null \
18+
--url https://circleci.com/api/v1.1/project/github/${{ secrets.CORPORATE_REPO }}/tree/master \
19+
--user '${{ secrets.CIRCLECI_USER_TOKEN }}:' \
20+
--data 'build_parameters[CIRCLE_JOB]=${{ secrets.CIRCLECI_JOB }}'

CHANGELOG.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
Version 3.10.0
2+
--------------
3+
4+
:Date: November 19, 2019
5+
6+
* `@stsewd <http://github.com/stsewd>`__: Set privacy level explicitly (`#6390 <https://github.com/readthedocs/readthedocs.org/pull/6390>`__)
7+
* `@ericholscher <http://github.com/ericholscher>`__: Redirect index files in proxito instead of serving (`#6387 <https://github.com/readthedocs/readthedocs.org/pull/6387>`__)
8+
* `@stsewd <http://github.com/stsewd>`__: Fix search indexing (`#6380 <https://github.com/readthedocs/readthedocs.org/pull/6380>`__)
9+
* `@humitos <http://github.com/humitos>`__: Include creditcard.png image (`#6379 <https://github.com/readthedocs/readthedocs.org/pull/6379>`__)
10+
* `@stsewd <http://github.com/stsewd>`__: Silent curl (`#6377 <https://github.com/readthedocs/readthedocs.org/pull/6377>`__)
11+
* `@stsewd <http://github.com/stsewd>`__: Use github actions to trigger tests in corporate (`#6376 <https://github.com/readthedocs/readthedocs.org/pull/6376>`__)
12+
* `@saadmk11 <http://github.com/saadmk11>`__: Show only users projects in the APIv3 browseable form (`#6374 <https://github.com/readthedocs/readthedocs.org/pull/6374>`__)
13+
* `@humitos <http://github.com/humitos>`__: Release 3.9.0 (`#6371 <https://github.com/readthedocs/readthedocs.org/pull/6371>`__)
14+
* `@davidfischer <http://github.com/davidfischer>`__: Pin the node dependencies with a package-lock (`#6370 <https://github.com/readthedocs/readthedocs.org/pull/6370>`__)
15+
* `@ericholscher <http://github.com/ericholscher>`__: Small optimization to not compute the highest version when it isn't displayed (`#6360 <https://github.com/readthedocs/readthedocs.org/pull/6360>`__)
16+
* `@krptic07 <http://github.com/krptic07>`__: remove rss feed (`#6348 <https://github.com/readthedocs/readthedocs.org/pull/6348>`__)
17+
* `@pyup-bot <http://github.com/pyup-bot>`__: pyup: Scheduled weekly dependency update for week 44 (`#6347 <https://github.com/readthedocs/readthedocs.org/pull/6347>`__)
18+
* `@ericholscher <http://github.com/ericholscher>`__: Port additional features to proxito (`#6286 <https://github.com/readthedocs/readthedocs.org/pull/6286>`__)
19+
* `@stsewd <http://github.com/stsewd>`__: Add docs for automatin rules (`#6072 <https://github.com/readthedocs/readthedocs.org/pull/6072>`__)
20+
* `@stsewd <http://github.com/stsewd>`__: Implement UI for automation rules (`#5996 <https://github.com/readthedocs/readthedocs.org/pull/5996>`__)
21+
122
Version 3.9.0
223
-------------
324

docs/automation-rules.rst

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
Automation Rules
2+
================
3+
4+
Automation rules allow project maintainers to automate actions on new branches and tags on repositories.
5+
6+
Creating an automation rule
7+
---------------------------
8+
9+
#. Go to your project dashboard
10+
#. Click :guilabel:`Admin` > :guilabel:`Automation Rules`
11+
#. Click on :guilabel:`Add Rule`
12+
#. Fill in the fields
13+
#. Click :guilabel:`Save`
14+
15+
How do they work?
16+
-----------------
17+
18+
When a new tag or branch is pushed to your repository,
19+
Read the Docs creates a new version.
20+
21+
All rules are evaluated for this version, in the order they are listed.
22+
If the version matches the version type and the pattern in the rule,
23+
the specified action is performed on that version.
24+
25+
.. note::
26+
27+
Versions can match multiple rules,
28+
and all matching actions will be performed on the version.
29+
30+
Predefined matches
31+
------------------
32+
33+
Automation rules support several predefined version matches:
34+
35+
- **Any version**: All new versions will match the rule.
36+
- **SemVer versions**: All new versions that follow `semantic versioning <https://semver.org/>`__ will match the rule.
37+
38+
User defined matches
39+
--------------------
40+
41+
If none of the above predefined matches meet your use case,
42+
you can use a **Custom match**.
43+
44+
The custom match should be a valid `Python regular expression <https://docs.python.org/3/library/re.html>`__.
45+
Each new version will be tested against this regular expression.
46+
47+
Actions
48+
-------
49+
50+
When a rule matches a new version, the specified action is performed on that version.
51+
Currently, the following actions are available:
52+
53+
- **Activate version**: Activates and builds the version.
54+
- **Set version as default**: Sets the version as default,
55+
i.e. the version of your project that `/` redirects to.
56+
See more in :ref:`automatic-redirects:Root URL`.
57+
It also activates and builds the version.
58+
59+
.. note::
60+
61+
If your versions follow :pep:`440`,
62+
Read the Docs activates and builds the version if it's greater than the current stable version.
63+
The stable version is also automatically updated at the same time.
64+
See more in :doc:`versions`.
65+
66+
Order
67+
-----
68+
69+
The order your rules are listed in :guilabel:`Admin` > :guilabel:`Automation Rules` matters.
70+
Each action will be performed in that order,
71+
so first rules have a higher priority.
72+
73+
You can change the order using the up and down arrow buttons.
74+
75+
.. note::
76+
77+
New rules are added at the end (lower priority).
78+
79+
Examples
80+
--------
81+
82+
Activate all new tags
83+
~~~~~~~~~~~~~~~~~~~~~
84+
85+
- Match: ``Any version``
86+
- Version type: ``Tag``
87+
- Action: ``Activate version``
88+
89+
Activate only new branches that belong to the ``1.x`` release
90+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91+
92+
- Custom match: ``^1\.\d+$``
93+
- Version type: ``Branch``
94+
- Action: ``Activate version``
95+
96+
Set as default new tags that have the ``-stable`` or ``-release`` suffix
97+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98+
99+
- Custom match: ``-(stable|release)$``
100+
- Version type: ``Tag``
101+
- Action: ``Set version as default``
102+
103+
.. note::
104+
105+
You can also create two rules:
106+
one to match ``-stable`` and other to match ``-release``.
107+
108+
Activate all new tags and branches that start with ``v`` or ``V``
109+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
110+
111+
- Custom match: ``^[vV]``
112+
- Version type: ``Tag``
113+
- Action: ``Activate version``
114+
115+
.. Force new line
116+
117+
- Custom match: ``^[vV]``
118+
- Version type: ``Branch``
119+
- Action: ``Activate version``
120+
121+
Activate all new tags that don't contain the ``-nightly`` suffix
122+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123+
124+
.. TODO: update example if https://github.com/readthedocs/readthedocs.org/issues/6354 is approved.
125+
126+
127+
- Custom match: ``.*(?<!-nightly)$``
128+
- Version type: ``Tag``
129+
- Action: ``Activate version``

docs/index.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ out of your documentation and Read the Docs.
121121
:doc:`User defined redirects <user-defined-redirects>` |
122122
:doc:`Automatic redirects <automatic-redirects>`
123123

124+
* **Versions**
125+
:doc:`Automation rules <automation-rules>`
126+
124127
* **Topic specific guides**:
125128
:doc:`How-to guides <guides/index>`
126129

@@ -142,6 +145,8 @@ out of your documentation and Read the Docs.
142145
user-defined-redirects
143146
automatic-redirects
144147

148+
automation-rules
149+
145150
guides/index
146151

147152
api/index

gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ var sources = {
4747
projects: {
4848
'js/tools.js': {},
4949
'js/import.js': {},
50+
'js/automation-rules.js': {},
5051
'css/import.less': {},
5152
'css/admin.less': {},
5253
},

media/css/core.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,13 @@ div.module.project-subprojects li.subproject a.subproject-edit:before {
13071307
content: "\f044";
13081308
}
13091309

1310+
/* Automation Rules */
1311+
1312+
li.automation-rule input[type="submit"] {
1313+
font-family: FontAwesome;
1314+
font-weight: normal;
1315+
}
1316+
13101317

13111318
/* Pygments */
13121319
div.highlight pre .hll { background-color: #ffffcc }

readthedocs/api/v2/views/footer_views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ def get_version_compare_data(project, base_version=None):
2626
:param base_version: We assert whether or not the base_version is also the
2727
highest version in the resulting "is_highest" value.
2828
"""
29+
if not project.show_version_warning:
30+
return {'is_highest': False}
31+
2932
versions_qs = (
3033
Version.internal.public(project=project)
3134
.filter(built=True, active=True)

readthedocs/api/v3/serializers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ class SubprojectCreateSerializer(FlexFieldsModelSerializer):
526526

527527
child = serializers.SlugRelatedField(
528528
slug_field='slug',
529-
queryset=Project.objects.all(),
529+
queryset=Project.objects.none(),
530530
)
531531

532532
class Meta:
@@ -545,6 +545,10 @@ def __init__(self, *args, **kwargs):
545545

546546
super().__init__(*args, **kwargs)
547547

548+
user = self.context['request'].user
549+
# TODO: Filter projects using project restrictions for subproject.
550+
self.fields['child'].queryset = user.projects.all()
551+
548552
def validate_child(self, value):
549553
# Check the user is maintainer of the child project
550554
user = self.context['request'].user

readthedocs/builds/constants.py

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
"""Constants for the builds app."""
42

53
from django.conf import settings
@@ -37,16 +35,20 @@
3735
# Manager name for External Versions or Builds.
3836
# ie: Only pull request/merge request Versions and Builds.
3937
EXTERNAL = 'external'
38+
EXTERNAL_TEXT = _('External')
4039

4140
BRANCH = 'branch'
41+
BRANCH_TEXT = _('Branch')
4242
TAG = 'tag'
43+
TAG_TEXT = _('Tag')
4344
UNKNOWN = 'unknown'
45+
UNKNOWN_TEXT = _('Unknown')
4446

4547
VERSION_TYPES = (
46-
(BRANCH, _('Branch')),
47-
(TAG, _('Tag')),
48-
(EXTERNAL, _('External')),
49-
(UNKNOWN, _('Unknown')),
48+
(BRANCH, BRANCH_TEXT),
49+
(TAG, TAG_TEXT),
50+
(EXTERNAL, EXTERNAL_TEXT),
51+
(UNKNOWN, UNKNOWN_TEXT),
5052
)
5153

5254
LATEST = settings.RTD_LATEST
@@ -101,3 +103,23 @@
101103
GITHUB_EXTERNAL_VERSION_NAME = 'Pull Request'
102104
GITLAB_EXTERNAL_VERSION_NAME = 'Merge Request'
103105
GENERIC_EXTERNAL_VERSION_NAME = 'External Version'
106+
107+
108+
# Automation rules
109+
110+
ALL_VERSIONS = 'all-versions'
111+
ALL_VERSIONS_REGEX = r'.*'
112+
SEMVER_VERSIONS = 'semver-versions'
113+
SEMVER_VERSIONS_REGEX = r'^v?(\d+\.)(\d+\.)(\d+)(-.+)?$'
114+
115+
116+
PREDEFINED_MATCH_ARGS = (
117+
(ALL_VERSIONS, _('Any version')),
118+
(SEMVER_VERSIONS, _('SemVer versions')),
119+
(None, _('Custom match')),
120+
)
121+
122+
PREDEFINED_MATCH_ARGS_VALUES = {
123+
ALL_VERSIONS: ALL_VERSIONS_REGEX,
124+
SEMVER_VERSIONS: SEMVER_VERSIONS_REGEX,
125+
}

0 commit comments

Comments
 (0)