Skip to content

Commit 4e53ed3

Browse files
authored
Merge pull request #7274 from Calinou/ci-build-epub
2 parents e834796 + 9d1dd80 commit 4e53ed3

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

.github/workflows/build_offline_docs.yml

+27-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-22.04
1212
strategy:
1313
matrix:
1414
branch:
1515
- master
16-
- stable
16+
- 3.6
1717
steps:
1818
- uses: actions/checkout@v3
1919
with:
@@ -23,8 +23,10 @@ jobs:
2323
run: |
2424
sudo pip3 install -r requirements.txt
2525
sudo pip3 install codespell
26+
sudo apt update
27+
sudo apt install parallel libwebp7
2628
27-
- name: Sphinx build HTML
29+
- name: Sphinx - Build HTML
2830
run: make SPHINXOPTS='--color' html
2931

3032
- uses: actions/upload-artifact@v3
@@ -34,3 +36,25 @@ jobs:
3436
# Keep the current build and the previous build (in case a scheduled build failed).
3537
# This makes it more likely to have at least one successful build available at all times.
3638
retention-days: 15
39+
40+
- name: Sphinx - Build ePub
41+
run: |
42+
# Convert WebP images to PNG and replace references, so that ePub readers can display those images.
43+
# The ePub 3.0 specification has WebP support, but it's not widely supported by apps and e-readers yet.
44+
shopt -s globstar nullglob
45+
parallel --will-cite convert {} {.}.png ::: {about,community,contributing,getting_started,img,tutorials}/**/*.webp
46+
parallel --will-cite sed -i "s/\\.webp$/\\.png/g" ::: {about,community,contributing,getting_started,tutorials}/**/*.rst
47+
48+
# Remove banners at the top of each page when building `latest`.
49+
sed -i 's/"godot_is_latest": True/"godot_is_latest": False/' conf.py
50+
sed -i 's/"godot_show_article_status": True/"godot_show_article_status": False/' conf.py
51+
52+
make SPHINXOPTS='--color' epub
53+
54+
- uses: actions/upload-artifact@v3
55+
with:
56+
name: godot-docs-epub-${{ matrix.branch }}
57+
path: _build/epub/GodotEngine.epub
58+
# Keep the current build and the previous build (in case a scheduled build failed).
59+
# This makes it more likely to have at least one successful build available at all times.
60+
retention-days: 15

README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,26 @@ They are meant to be parsed with the [Sphinx](https://www.sphinx-doc.org/) docum
66

77
## Download for offline use
88

9-
You can [download an HTML copy](https://nightly.link/godotengine/godot-docs/workflows/build_offline_docs/master/godot-docs-html-master.zip)
9+
To browse the documentation offline, you can use the mirror of the documentation
10+
hosted on [DevDocs](https://devdocs.io/godot/). To enable offline browsing on
11+
DevDocs, you need to:
12+
13+
- Click the three dots in the top-left corner, choose **Preferences**.
14+
- Enable the desired version of the Godot documentation by checking the box
15+
next to it in the sidebar.
16+
- Click the three dots in the top-left corner, choose **Offline data**.
17+
- Click the **Install** link next to the Godot documentation.
18+
19+
You can also
20+
[download an HTML copy](https://nightly.link/godotengine/godot-docs/workflows/build_offline_docs/master/godot-docs-html-master.zip)
1021
for offline reading (updated every Monday). Extract the ZIP archive then open
1122
the top-level `index.html` in a web browser.
1223

24+
For mobile devices or e-readers, you can also
25+
[download an ePub copy](https://nightly.link/godotengine/godot-docs/workflows/build_offline_docs/master/godot-docs-epub-master.zip)
26+
for offline reading (updated every Monday). Extract the ZIP archive then open
27+
the `GodotEngine.epub` file in an e-book reader application.
28+
1329
## Theming
1430

1531
The Godot documentation uses the default `sphinx_rtd_theme` with many

index.rst

+3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ You can also `download an HTML copy <https://nightly.link/godotengine/godot-docs
6565
for offline reading (updated every Monday). Extract the ZIP archive then open
6666
the top-level ``index.html`` in a web browser.
6767

68+
For mobile devices or e-readers, you can also `download an ePub copy <https://nightly.link/godotengine/godot-docs/workflows/build_offline_docs/master/godot-docs-epub-master.zip>`__
69+
for offline reading (updated every Monday). Extract the ZIP archive then open
70+
the ``GodotEngine.epub`` file in an e-book reader application.
6871

6972
.. Below is the main table-of-content tree of the documentation website.
7073
It is hidden on the page itself, but it makes up the sidebar for navigation.

0 commit comments

Comments
 (0)