Browse Source

Build MkDocs Lua API docs using GitHub CI, deploy to api.minetest.net (#13675)

* Build MkDocs Lua API documentation using GitHub CI and Pages instead

* Remove Lua highlight hack as codeblocks are correctly marked as Lua now

* fix line endings
ROllerozxa 7 months ago
parent
commit
5949172735
5 changed files with 51 additions and 15 deletions
  1. 48 0
      .github/workflows/lua_api_deploy.yml
  2. 1 0
      CNAME
  3. 0 4
      doc/mkdocs/build.sh
  4. 0 9
      doc/mkdocs/lua_highlight.patch
  5. 2 2
      doc/mkdocs/requirements.txt

+ 48 - 0
.github/workflows/lua_api_deploy.yml

@@ -0,0 +1,48 @@
+name: lua_api_deploy
+
+permissions:
+  contents: read
+  pages: write
+  id-token: write
+
+on:
+  push:
+    paths:
+      - '.github/workflows/lua_api_deploy.yml'
+      - 'doc/lua_api.md'
+      - 'doc/mkdocs/'
+    branches:
+      - master
+
+jobs:
+  build:
+    runs-on: ubuntu-22.04
+
+    steps:
+      - uses: actions/checkout@v3
+
+      - name: Set up Python
+        uses: actions/setup-python@v4
+        with:
+          python-version: 3.11
+
+      - name: Install mkdocs
+        run: |
+          pip install -U -r doc/mkdocs/requirements.txt
+
+      - name: Build documentation
+        run: |
+          cd doc/mkdocs/
+          ./build.sh
+
+      - name: Setup Pages
+        uses: actions/configure-pages@v3
+
+      - name: Upload artifact
+        uses: actions/upload-pages-artifact@v2
+        with:
+          path: 'public/'
+
+      - name: Deploy to GitHub Pages
+        id: deployment
+        uses: actions/deploy-pages@v2

+ 1 - 0
CNAME

@@ -0,0 +1 @@
+api.minetest.net

+ 0 - 4
doc/mkdocs/build.sh

@@ -1,9 +1,5 @@
 #!/bin/sh -e
 
-# Patch Python-Markdown
-MARKDOWN_FILE=$(pip show markdown | awk '/Location/ { print $2 }')/markdown/extensions/codehilite.py
-patch -N -r - $MARKDOWN_FILE lua_highlight.patch || true
-
 # Split lua_api.md on top level headings
 cat ../lua_api.md | csplit -sz -f docs/section - '/^=/-1' '{*}'
 

+ 0 - 9
doc/mkdocs/lua_highlight.patch

@@ -1,9 +0,0 @@
-@@ -75,7 +75,7 @@
-                  css_class="codehilite", lang=None, style='default',
-                  noclasses=False, tab_length=4, hl_lines=None, use_pygments=True):
-         self.src = src
--        self.lang = lang
-+        self.lang = "lua"
-         self.linenums = linenums
-         self.guess_lang = guess_lang
-         self.css_class = css_class

+ 2 - 2
doc/mkdocs/requirements.txt

@@ -1,2 +1,2 @@
-mkdocs~=1.3.0
-pygments~=2.12.0
+mkdocs~=1.4.3
+pygments~=2.15.1