Skip to content

Commit 7069741

Browse files
ci(build): preview PR builds via Read the Docs
1 parent 7607221 commit 7069741

2 files changed

Lines changed: 79 additions & 0 deletions

File tree

.readthedocs.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
version: 2
6+
7+
build:
8+
os: ubuntu-24.04
9+
tools:
10+
ruby: "3.3"
11+
commands:
12+
- |
13+
chmod +x "./scripts/readthedocs_build.sh"
14+
"./scripts/readthedocs_build.sh"
15+
16+
submodules:
17+
include: all
18+
recursive: true

scripts/readthedocs_build.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# set default directories
5+
project_dir="."
6+
theme_dir="."
7+
8+
# TODO: make this work for subproject gh-pages
9+
# if not the theme project then we need to clone the theme with submodules
10+
if [ "$READTHEDOCS_PROJECT" != "lizardbytegithubio" ]; then
11+
theme_dir="theme"
12+
git clone --depth 1 https://github.com/LizardByte/LizardByte.github.io.git ${theme_dir} --recurse-submodules
13+
fi
14+
15+
TMPDIR=$(pwd)/../tmp
16+
mkdir -p ${TMPDIR}
17+
18+
base_dirs=(
19+
${theme_dir}/third-party/beautiful-jekyll
20+
${theme_dir}
21+
)
22+
23+
targets=(
24+
*.gemspec
25+
_data
26+
_includes
27+
_layouts
28+
_sass
29+
assets
30+
404.html
31+
_config_theme.yml
32+
favicon.ico
33+
feed.xml
34+
Gemfile
35+
staticman.yml
36+
tags.html
37+
)
38+
39+
for base_dir in "${base_dirs[@]}"; do
40+
for target in "${targets[@]}"; do
41+
if [ -e "$base_dir/$target" ]; then
42+
cp -rf "$base_dir/$target" ${TMPDIR}/
43+
fi
44+
done
45+
done
46+
47+
# copy project directory, they should only come from the project repo
48+
cp -RTf ${project_dir}/ ${TMPDIR}/
49+
50+
cd ${TMPDIR}
51+
52+
gem install bundle
53+
bundle install
54+
echo "baseurl: $READTHEDOCS_VERSION" > _config_rtd.yml
55+
cat _config_rtd.yml
56+
cat _config_theme.yml
57+
bundle exec jekyll build \
58+
--future \
59+
--config _config_rtd.yml,_config_theme.yml \
60+
--destination $READTHEDOCS_OUTPUT/html
61+
ls -Ra $READTHEDOCS_OUTPUT

0 commit comments

Comments
 (0)