Build ePubs of the documentation for offline reading

This commit is contained in:
Hugo Locurcio
2023-04-25 01:36:41 +02:00
parent 4cc818f793
commit 9d1dd80374
3 changed files with 47 additions and 4 deletions

View File

@@ -8,12 +8,12 @@ on:
jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
branch:
- master
- stable
- 3.6
steps:
- uses: actions/checkout@v3
with:
@@ -23,8 +23,10 @@ jobs:
run: |
sudo pip3 install -r requirements.txt
sudo pip3 install codespell
sudo apt update
sudo apt install parallel libwebp7
- name: Sphinx build HTML
- name: Sphinx - Build HTML
run: make SPHINXOPTS='--color' html
- uses: actions/upload-artifact@v3
@@ -34,3 +36,25 @@ jobs:
# Keep the current build and the previous build (in case a scheduled build failed).
# This makes it more likely to have at least one successful build available at all times.
retention-days: 15
- name: Sphinx - Build ePub
run: |
# Convert WebP images to PNG and replace references, so that ePub readers can display those images.
# The ePub 3.0 specification has WebP support, but it's not widely supported by apps and e-readers yet.
shopt -s globstar nullglob
parallel --will-cite convert {} {.}.png ::: {about,community,contributing,getting_started,img,tutorials}/**/*.webp
parallel --will-cite sed -i "s/\\.webp$/\\.png/g" ::: {about,community,contributing,getting_started,tutorials}/**/*.rst
# Remove banners at the top of each page when building `latest`.
sed -i 's/"godot_is_latest": True/"godot_is_latest": False/' conf.py
sed -i 's/"godot_show_article_status": True/"godot_show_article_status": False/' conf.py
make SPHINXOPTS='--color' epub
- uses: actions/upload-artifact@v3
with:
name: godot-docs-epub-${{ matrix.branch }}
path: _build/epub/GodotEngine.epub
# Keep the current build and the previous build (in case a scheduled build failed).
# This makes it more likely to have at least one successful build available at all times.
retention-days: 15