Skip to content

Commit

Permalink
Merge pull request #853 from plone/rtd-pr-preview
Browse files Browse the repository at this point in the history
Replace Netlify with Read the Docs pull request previews
  • Loading branch information
stevepiercy authored Oct 10, 2024
2 parents 638a1f7 + e03fc41 commit 91cd621
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 5 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/rtd-pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# .github/workflows/rtd-pr-preview.yml
name: readthedocs/actions
on:
pull_request_target:
types:
- opened
# Execute this action only on PRs that touch
# documentation files.
# paths:
# - "docs/**"

permissions:
pull-requests: write

jobs:
documentation-links:
runs-on: ubuntu-latest
steps:
- uses: readthedocs/actions/preview@v1
with:
project-slug: "plone6"
single-version: "true"
25 changes: 25 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
commands:
# Cancel building pull requests when there aren't changes in the docs directory or YAML file.
# You can add any other files or directories that you'd like here as well,
# like your docs requirements file, or other files that will change your docs build.
#
# If there are no changes (git diff exits with 0) we force the command to return with 183.
# This is a special exit code on Read the Docs that will cancel the build immediately.
- |
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- docs/ .readthedocs.yaml requirements.txt;
then
exit 183;
fi
- make rtd-pr-preview
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ test: clean linkcheckbroken ## Clean docs build, then run linkcheckbroken
.PHONY: deploy
deploy: clean html

.PHONY: netlify
netlify:
.PHONY: rtd-pr-preview
rtd-pr-preview: ## Build pull request preview on Read the Docs
pip install -r requirements.txt
cd $(DOCS_DIR) && sphinx-build -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
cd $(DOCS_DIR) && sphinx-build -b html $(ALLSPHINXOPTS) ${READTHEDOCS_OUTPUT}/html/

.PHONY: all
all: clean vale linkcheck html ## Run checks and build html
2 changes: 0 additions & 2 deletions netlify.toml

This file was deleted.

0 comments on commit 91cd621

Please sign in to comment.