Browse Source

Use a separate GitHub Actions workflow to build offline documentation (#4733)

This is required to get a permalink using https://nightly.link
as we need the workflow containing the offline docs ZIP artifact
to always be the latest one. Creating a second workflow is a good
way to solve this.

This also makes it easier to distinguish between linting checks
and offline documentation builds in the repository's Actions tab.
Hugo Locurcio 4 years ago
parent
commit
cc18f02b4a
4 changed files with 47 additions and 4 deletions
  1. 31 0
      .github/workflows/build_offline_docs.yml
  2. 4 2
      .github/workflows/ci.yml
  3. 6 0
      README.md
  4. 6 2
      index.rst

+ 31 - 0
.github/workflows/build_offline_docs.yml

@@ -0,0 +1,31 @@
+name: Build documentation for offline usage
+on:
+  schedule:
+    # Every week on Monday at midnight (UTC).
+    # This keeps the generated HTML documentation fresh.
+    - cron: '0 0 * * 1'
+
+jobs:
+  build:
+    runs-on: ubuntu-20.04
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: Install dependencies
+        run: |
+          sudo pip3 install -r requirements.txt
+          sudo pip3 install codespell
+
+      # Build the HTML to upload it.
+      - name: Sphinx build
+        run: |
+          sphinx-build --color -d _build/doctrees -W . _build/html
+
+      - uses: actions/upload-artifact@v2
+        with:
+          name: godot-docs-html
+          path: _build/html
+          # 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

+ 4 - 2
.github/workflows/ci.yml

@@ -1,5 +1,7 @@
 name: Continuous integration
-on: [push, pull_request]
+on:
+  push:
+  pull_request:
 
 jobs:
   build:
@@ -21,7 +23,7 @@ jobs:
           bash _tools/format.sh
           codespell -I _tools/codespell-ignore.txt -x _tools/codespell-ignore-lines.txt {about,community,development,getting_started,tutorials}/**/*.rst
 
+      # Use dummy builder to improve performance as we don't need the generated HTML in this workflow.
       - name: Sphinx build
         run: |
-          # Use dummy builder to improve performance.
           sphinx-build --color -b dummy -d _build/doctrees -W . _build/html

+ 6 - 0
README.md

@@ -4,6 +4,12 @@ This repository contains the source files of [Godot Engine](https://godotengine.
 
 They are meant to be parsed with the [Sphinx](https://www.sphinx-doc.org/) documentation builder to build the HTML documentation on [Godot's website](https://docs.godotengine.org).
 
+## Download for offline use
+
+You can [download an HTML copy](https://nightly.link/godotengine/godot-docs/workflows/build_offline_docs/3.3/godot-docs-html.zip)
+for offline reading (updated every Monday). Extract the ZIP archive then open
+the top-level `index.html` in a web browser.
+
 ## Theming
 
 The Godot documentation uses the default ``sphinx_rtd_theme`` with many

+ 6 - 2
index.rst

@@ -38,6 +38,10 @@ The table of contents below and in the sidebar should let you easily access the
 documentation for your topic of interest. You can also use the search function
 in the top left corner.
 
+You can also `download an HTML copy <https://nightly.link/godotengine/godot-docs/workflows/build_offline_docs/3.3/godot-docs-html.zip>`__
+for offline reading (updated every Monday). Extract the ZIP archive then open
+the top-level ``index.html`` in a web browser.
+
 .. note:: Godot Engine is an open source project developed by a community of
           volunteers. The documentation team can always use your
           feedback and help to improve the tutorials and class reference. If
@@ -51,8 +55,8 @@ in the top left corner.
           <https://hosted.weblate.org/engage/godot-engine/>`_ into your
           language, or talk to us on either the ``#documentation``
           channel on `Discord <https://discord.gg/zH7NUgz>`_, or the
-          ``#godotengine-doc`` channel on `irc.freenode.net
-          <http://webchat.freenode.net/?channels=#godotengine-doc>`_!
+          ``#documentation`` channel on the `Godot Contributors Chat
+          <https://chat.godotengine.org/>`_!
 
 .. centered:: |weblate_widget|