|
1 | 1 | Environment Variables |
2 | 2 | ===================== |
3 | 3 |
|
4 | | -Read the Docs supports environment variables when building your project. |
5 | | -There are two types of them: |
| 4 | +Read the Docs supports two types of environment variables in project builds: |
6 | 5 |
|
7 | | -* default environment variables |
8 | | -* user-defined environment variables |
| 6 | +* `Default environment variables`_ |
| 7 | +* `User-defined environment variables`_ |
9 | 8 |
|
10 | | -Both are merged together during the build process and exposed to all the commands executed when building the documentation. |
| 9 | +Both are merged together during the build process and are exposed to all of the executed commands. There are two exceptions for user-defined environment variables however: |
11 | 10 |
|
| 11 | +* User-defined variables are not available during the checkout step of the :doc:`build process </builds>` |
| 12 | +* User-defined variables that are not marked as public will not be available in :doc:`pull request builds </pull-requests>` |
12 | 13 |
|
13 | 14 | Default environment variables |
14 | 15 | ----------------------------- |
15 | 16 |
|
16 | | -Read the Docs builder sets the following environment variables when building your documentation: |
| 17 | +Read the Docs builders set the following environment variables automatically for each documentation build: |
17 | 18 |
|
18 | | -.. csv-table:: Environment Variables |
19 | | - :header: Environment variable, Description, Example value |
20 | | - :widths: 15, 10, 30 |
| 19 | +.. envvar:: READTHEDOCS |
21 | 20 |
|
22 | | - ``READTHEDOCS``, Whether the build is running inside Read the Docs, ``True`` |
23 | | - ``READTHEDOCS_VERSION``, The Read the Docs slug of the version which is being built, ``latest`` |
24 | | - ``READTHEDOCS_VERSION_NAME``, Corresponding version name as displayed in Read the Docs' version switch menu, ``stable`` |
25 | | - ``READTHEDOCS_VERSION_TYPE``, Type of the event triggering the build, ``branch`` | ``tag`` | ``external`` (for :doc:`pull request builds </pull-requests>`) | ``unknown`` |
26 | | - ``READTHEDOCS_PROJECT``, The Read the Docs' slug of the project which is being built, ``my-example-project`` |
27 | | - ``READTHEDOCS_LANGUAGE``, The Read the Docs' language slug of the project which is being built, ``en`` |
| 21 | + Whether the build is running inside Read the Docs. |
28 | 22 |
|
29 | | -.. note:: |
| 23 | + :Default: ``True`` |
| 24 | + |
| 25 | +.. envvar:: READTHEDOCS_VERSION |
| 26 | + |
| 27 | + The :term:`slug` of the version being built, such as ``latest``, ``stable``, |
| 28 | + or a branch name like ``feature-1234``. For :doc:`pull request builds </pull-requests>`, |
| 29 | + the value will be the pull request number. |
| 30 | + |
| 31 | +.. envvar:: READTHEDOCS_VERSION_NAME |
| 32 | + |
| 33 | + The verbose name of the version being built, such as ``latest``, ``stable``, |
| 34 | + or a branch name like ``feature/1234``. |
| 35 | + |
| 36 | +.. envvar:: READTHEDOCS_VERSION_TYPE |
| 37 | + |
| 38 | + The type of the version being built. |
| 39 | + |
| 40 | + :Values: ``branch``, ``tag``, ``external`` (for :doc:`pull request builds </pull-requests>`), or ``unknown`` |
| 41 | + |
| 42 | +.. envvar:: READTHEDOCS_PROJECT |
| 43 | + |
| 44 | + The :term:`slug` of the project being built. For example, ``my-example-project``. |
| 45 | + |
| 46 | +.. envvar:: READTHEDOCS_LANGUAGE |
30 | 47 |
|
31 | | - The term slug is used to refer to a unique string across projects/versions containing ASCII characters only. |
32 | | - This value is used in the URLs of your documentation. |
| 48 | + The locale name, or the identifier for the locale, for the project being built. |
| 49 | + This value comes from the project's configured language. |
33 | 50 |
|
| 51 | + :Examples: ``en``, ``it``, ``de_AT``, ``es``, ``pt_BR`` |
34 | 52 |
|
35 | 53 | User-defined environment variables |
36 | 54 | ---------------------------------- |
|
0 commit comments