From 55afe22bbf6bfb663691deb91cdddec507caf76e Mon Sep 17 00:00:00 2001 From: Carl Gay Date: Sat, 20 Apr 2024 20:06:56 -0400 Subject: [PATCH] automation: deploy docs to dylan-lang.github.io --- .../build-and-deploy-documentation.yml | 55 +++++++++++++++++++ documentation/Makefile | 2 +- documentation/source/conf.py | 9 +++ 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-and-deploy-documentation.yml diff --git a/.github/workflows/build-and-deploy-documentation.yml b/.github/workflows/build-and-deploy-documentation.yml new file mode 100644 index 0000000..6a23f9b --- /dev/null +++ b/.github/workflows/build-and-deploy-documentation.yml @@ -0,0 +1,55 @@ +name: Build and deploy documentation + +on: + push: + # all branches + pull_request: + + # This enables the Run Workflow button on the Actions tab. + workflow_dispatch: + +# https://github.com/JamesIves/github-pages-deploy-action#readme +permissions: + contents: write + +# Set DYLAN environment variable to GITHUB_WORKSPACE so packages are +# installed in ../../_packages relative to documentation's Makefile +env: + DYLAN: ${{ github.workspace }} + +jobs: + + build-and-deploy: + runs-on: ubuntu-latest + steps: + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Check links + uses: addnab/docker-run-action@v3 + with: + image: ghcr.io/fraya/dylan-docs + options: -v ${{ github.workspace }}/documentation:/docs + run: make linkcheck + + - name: Build docs + uses: addnab/docker-run-action@v3 + with: + image: ghcr.io/fraya/dylan-docs + options: -v ${{ github.workspace }}/documentation:/docs + run: make html + + - name: Upload html + uses: actions/upload-artifact@v4 + with: + name: lsp-dylan + path: documentation/build/html/ + + - name: Bypass Jekyll on GH Pages + run: sudo touch documentation/build/html/.nojekyll + + - name: Deploy docs + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: documentation/build/html diff --git a/documentation/Makefile b/documentation/Makefile index be50b8a..aa17719 100644 --- a/documentation/Makefile +++ b/documentation/Makefile @@ -17,4 +17,4 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/documentation/source/conf.py b/documentation/source/conf.py index 80d8ba3..3f3c878 100644 --- a/documentation/source/conf.py +++ b/documentation/source/conf.py @@ -56,3 +56,12 @@ # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] + + +# Ignore GitHub source code links with line number anchors in them because +# they're apparently handled via Javascript and won't be found in the HTML. +# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-linkcheck_anchors_ignore +linkcheck_anchors_ignore = [r"^L\d+$"] + +# Ignore certificate verification +tls_verify = False