build_offline_docs.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. # Don't run scheduled runs on forks unless the CI_OFFLINE_DOCS_CRON variable is set to 'true'.
  11. # Manual runs can still be triggered as normal.
  12. if: ${{ github.repository_owner == 'godotengine' || github.event_name != 'schedule' || vars.CI_OFFLINE_DOCS_CRON == 'true' }}
  13. runs-on: ubuntu-22.04
  14. strategy:
  15. matrix:
  16. branch:
  17. - master
  18. - stable
  19. - 3.6
  20. steps:
  21. - uses: actions/checkout@v4
  22. with:
  23. ref: ${{ matrix.branch }}
  24. - name: Install dependencies
  25. run: |
  26. sudo pip3 install -r requirements.txt
  27. sudo apt update
  28. sudo apt install parallel libwebp7
  29. - name: Sphinx - Build HTML
  30. run: make SPHINXOPTS='--color' html
  31. - uses: actions/upload-artifact@v4
  32. with:
  33. name: godot-docs-html-${{ matrix.branch }}
  34. path: _build/html
  35. # Keep the current build and the previous build (in case a scheduled build failed).
  36. # This makes it more likely to have at least one successful build available at all times.
  37. retention-days: 15
  38. - name: Sphinx - Build ePub
  39. run: |
  40. # Convert WebP images to PNG and replace references, so that ePub readers can display those images.
  41. # The ePub 3.0 specification has WebP support, but it's not widely supported by apps and e-readers yet.
  42. shopt -s globstar nullglob
  43. parallel --will-cite convert {} {.}.png ::: {about,community,contributing,getting_started,img,tutorials}/**/*.webp
  44. parallel --will-cite sed -i "s/\\.webp$/\\.png/g" ::: {about,community,contributing,getting_started,tutorials}/**/*.rst
  45. # Remove banners at the top of each page when building `latest`.
  46. sed -i 's/"godot_is_latest": True/"godot_is_latest": False/' conf.py
  47. sed -i 's/"godot_show_article_status": True/"godot_show_article_status": False/' conf.py
  48. make SPHINXOPTS='--color' epub
  49. - uses: actions/upload-artifact@v4
  50. with:
  51. name: godot-docs-epub-${{ matrix.branch }}
  52. path: _build/epub/GodotEngine.epub
  53. # Keep the current build and the previous build (in case a scheduled build failed).
  54. # This makes it more likely to have at least one successful build available at all times.
  55. retention-days: 15