From 7ce8fba3cbf2174917e1672ac557fbba3493a121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bence=20Sz=C3=A9pk=C3=BAti?= Date: Fri, 14 Apr 2023 16:36:19 +0200 Subject: [PATCH] Add post-build step to update redirects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows us to maintain the list of redirects in-tree. Signed-off-by: Bence Szépkúti --- .readthedocs.yaml | 7 +++++-- docs/redirects.yaml | 10 ++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 docs/redirects.yaml diff --git a/.readthedocs.yaml b/.readthedocs.yaml index cef07bf1c..104ef7674 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -12,8 +12,11 @@ build: python: "3.9" jobs: pre_build: - - make apidoc - - breathe-apidoc -o docs/api apidoc/xml + - make apidoc + - breathe-apidoc -o docs/api apidoc/xml + post_build: + - '[ "$READTHEDOCS_VERSION" != "development" ] || "$READTHEDOCS_VIRTUALENV_PATH/bin/rtd" projects "Mbed TLS API" redirects sync --wet-run -f docs/redirects.yaml' + # Build documentation in the docs/ directory with Sphinx sphinx: diff --git a/docs/redirects.yaml b/docs/redirects.yaml new file mode 100644 index 000000000..c3a13f302 --- /dev/null +++ b/docs/redirects.yaml @@ -0,0 +1,10 @@ +# Readthedocs redirects +# See https://docs.readthedocs.io/en/stable/user-defined-redirects.html +# +# In order to prevent exposing the API token, PR jobs do not update the +# redirects - changes to this file are only applied when they are merged +# into the main branch. + +- type: exact + from_url: /projects/api/en/latest/$rest + to_url: /projects/api/en/development/