build_offline_docs.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. name: Build documentation for offline usage
  2. on:
  3. workflow_dispatch:
  4. schedule:
  5. # Every week on Monday at midnight (UTC).
  6. # This keeps the generated HTML documentation fresh.
  7. - cron: '0 0 * * 1'
  8. jobs:
  9. build:
  10. runs-on: ubuntu-22.04
  11. strategy:
  12. matrix:
  13. branch:
  14. - master
  15. - 3.6
  16. steps:
  17. - uses: actions/checkout@v4
  18. with:
  19. ref: ${{ matrix.branch }}
  20. - name: Install dependencies
  21. run: |
  22. sudo pip3 install -r requirements.txt
  23. sudo pip3 install codespell
  24. sudo apt update
  25. sudo apt install parallel libwebp7
  26. - name: Sphinx - Build HTML
  27. run: make SPHINXOPTS='--color' html
  28. - uses: actions/upload-artifact@v4
  29. with:
  30. name: godot-docs-html-${{ matrix.branch }}
  31. path: _build/html
  32. # Keep the current build and the previous build (in case a scheduled build failed).
  33. # This makes it more likely to have at least one successful build available at all times.
  34. retention-days: 15
  35. - name: Sphinx - Build ePub
  36. run: |
  37. # Convert WebP images to PNG and replace references, so that ePub readers can display those images.
  38. # The ePub 3.0 specification has WebP support, but it's not widely supported by apps and e-readers yet.
  39. shopt -s globstar nullglob
  40. parallel --will-cite convert {} {.}.png ::: {about,community,contributing,getting_started,img,tutorials}/**/*.webp
  41. parallel --will-cite sed -i "s/\\.webp$/\\.png/g" ::: {about,community,contributing,getting_started,tutorials}/**/*.rst
  42. # Remove banners at the top of each page when building `latest`.
  43. sed -i 's/"godot_is_latest": True/"godot_is_latest": False/' conf.py
  44. sed -i 's/"godot_show_article_status": True/"godot_show_article_status": False/' conf.py
  45. make SPHINXOPTS='--color' epub
  46. - uses: actions/upload-artifact@v4
  47. with:
  48. name: godot-docs-epub-${{ matrix.branch }}
  49. path: _build/epub/GodotEngine.epub
  50. # Keep the current build and the previous build (in case a scheduled build failed).
  51. # This makes it more likely to have at least one successful build available at all times.
  52. retention-days: 15