mirror of https://github.com/python/cpython
Replace Netlify with Read the Docs build previews (#103843)
Co-authored-by: Oleg Iarygin <dralife@yandex.ru> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
This commit is contained in:
parent
4b10ecc29f
commit
accb417c33
|
@ -0,0 +1,27 @@
|
||||||
|
name: Read the Docs PR preview
|
||||||
|
# Automatically edits a pull request's descriptions with a link
|
||||||
|
# to the documentation's preview on Read the Docs.
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
paths:
|
||||||
|
- 'Doc/**'
|
||||||
|
- '.github/workflows/doc.yml'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
documentation-links:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: readthedocs/actions/preview@v1
|
||||||
|
with:
|
||||||
|
project-slug: "cpython-previews"
|
||||||
|
single-version: "true"
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Read the Docs configuration file
|
||||||
|
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||||
|
# Project page: https://readthedocs.org/projects/cpython-previews/
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
sphinx:
|
||||||
|
configuration: Doc/conf.py
|
||||||
|
|
||||||
|
build:
|
||||||
|
os: ubuntu-22.04
|
||||||
|
tools:
|
||||||
|
python: "3"
|
||||||
|
|
||||||
|
commands:
|
||||||
|
- make -C Doc venv html
|
||||||
|
- mkdir _readthedocs
|
||||||
|
- mv Doc/build/html _readthedocs/html
|
11
Doc/conf.py
11
Doc/conf.py
|
@ -114,12 +114,13 @@ if any('htmlhelp' in arg for arg in sys.argv):
|
||||||
# Short title used e.g. for <title> HTML tags.
|
# Short title used e.g. for <title> HTML tags.
|
||||||
html_short_title = '%s Documentation' % release
|
html_short_title = '%s Documentation' % release
|
||||||
|
|
||||||
# Deployment preview information, from Netlify
|
# Deployment preview information
|
||||||
# (See netlify.toml and https://docs.netlify.com/configure-builds/environment-variables/#git-metadata)
|
# (See .readthedocs.yml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html)
|
||||||
|
repository_url = os.getenv("READTHEDOCS_GIT_CLONE_URL")
|
||||||
html_context = {
|
html_context = {
|
||||||
"is_deployment_preview": os.getenv("IS_DEPLOYMENT_PREVIEW"),
|
"is_deployment_preview": os.getenv("READTHEDOCS_VERSION_TYPE") == "external",
|
||||||
"repository_url": os.getenv("REPOSITORY_URL"),
|
"repository_url": repository_url.removesuffix(".git") if repository_url else None,
|
||||||
"pr_id": os.getenv("REVIEW_ID")
|
"pr_id": os.getenv("READTHEDOCS_VERSION")
|
||||||
}
|
}
|
||||||
|
|
||||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||||
|
|
|
@ -11,11 +11,6 @@
|
||||||
|
|
||||||
{%- if is_deployment_preview %}
|
{%- if is_deployment_preview %}
|
||||||
<div id="deployment-preview-warning" style="padding: .5em; text-align: center; background-color: #fff2ba; color: #6a580e;">
|
<div id="deployment-preview-warning" style="padding: .5em; text-align: center; background-color: #fff2ba; color: #6a580e;">
|
||||||
<div style="float: right; margin-top: -10px; margin-left: 10px;">
|
|
||||||
<a href="https://www.netlify.com">
|
|
||||||
<img src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg" alt="Deploys by Netlify" />
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
{% trans %}This is a deploy preview created from a <a href="{{ repository_url }}/pull/{{ pr_id }}">pull request</a>.
|
{% trans %}This is a deploy preview created from a <a href="{{ repository_url }}/pull/{{ pr_id }}">pull request</a>.
|
||||||
For authoritative documentation, see the {% endtrans %}
|
For authoritative documentation, see the {% endtrans %}
|
||||||
<a href="https://docs.python.org/3/{{ pagename }}{{ file_suffix }}">{% trans %} the current stable release{% endtrans %}</a>.
|
<a href="https://docs.python.org/3/{{ pagename }}{{ file_suffix }}">{% trans %} the current stable release{% endtrans %}</a>.
|
||||||
|
|
11
netlify.toml
11
netlify.toml
|
@ -1,11 +0,0 @@
|
||||||
[build]
|
|
||||||
base = "Doc/"
|
|
||||||
command = "make html"
|
|
||||||
publish = "build/html"
|
|
||||||
# Do not trigger netlify builds if docs were not changed.
|
|
||||||
# Changed files should be in sync with `.github/workflows/doc.yml`
|
|
||||||
ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../netlify.toml"
|
|
||||||
|
|
||||||
[build.environment]
|
|
||||||
PYTHON_VERSION = "3.8"
|
|
||||||
IS_DEPLOYMENT_PREVIEW = "true"
|
|
Loading…
Reference in New Issue