|
| 1 | +# Part of the EDG Compiler Project, under the Apache License v2.0 with LLVM |
| 2 | +# Exceptions. |
| 3 | +# See https://edgcpp.org/LICENSE.txt for license information. |
| 4 | +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 5 | +# |
| 6 | +# Build the Sphinx documentation in doc/ with warnings treated as errors, so |
| 7 | +# documentation changes stay publishable. |
| 8 | +# |
| 9 | +# The build runs in the edgcpp/sphinx-env image, which the site workflow |
| 10 | +# described below also builds the published documentation with. That image |
| 11 | +# installs the packages pinned in doc/requirements.txt, so after changing |
| 12 | +# them, rebuild it with build-edg-env sphinx-env and push it to Docker Hub. |
| 13 | +# |
| 14 | +# The documentation is published by the edgcpp/edgcpp.github.io site |
| 15 | +# workflow, not from here: it builds the release tag into |
| 16 | +# https://edgcpp.org/doc/ and main into https://edgcpp.org/dev/doc/. After a |
| 17 | +# push to main passes the build, this asks that workflow to run so the |
| 18 | +# development documentation is updated. That needs the SITE_DISPATCH_TOKEN |
| 19 | +# secret: a fine-grained token for edgcpp/edgcpp.github.io only, with |
| 20 | +# "Actions: Read and write" permission. |
| 21 | + |
| 22 | +name: Documentation |
| 23 | + |
| 24 | +on: |
| 25 | + push: |
| 26 | + branches: |
| 27 | + - main |
| 28 | + paths: |
| 29 | + - 'doc/**' |
| 30 | + - '.github/workflows/documentation.yml' |
| 31 | + pull_request: |
| 32 | + paths: |
| 33 | + - 'doc/**' |
| 34 | + - '.github/workflows/documentation.yml' |
| 35 | + workflow_dispatch: |
| 36 | + |
| 37 | +permissions: |
| 38 | + contents: read |
| 39 | + |
| 40 | +concurrency: |
| 41 | + group: documentation-${{ github.ref }} |
| 42 | + cancel-in-progress: true |
| 43 | + |
| 44 | +jobs: |
| 45 | + build: |
| 46 | + name: Build HTML documentation |
| 47 | + runs-on: ubuntu-latest |
| 48 | + timeout-minutes: 15 |
| 49 | + container: |
| 50 | + image: docker.io/edgcpp/sphinx-env:latest |
| 51 | + steps: |
| 52 | + - name: Check out repository |
| 53 | + uses: actions/checkout@v7 |
| 54 | + |
| 55 | + # The published site uses the dirhtml builder, so check that one. |
| 56 | + - name: Build HTML |
| 57 | + run: make -C doc dirhtml SPHINXOPTS="-W" |
| 58 | + |
| 59 | + publish-dev: |
| 60 | + name: Publish development documentation |
| 61 | + needs: build |
| 62 | + if: > |
| 63 | + github.repository == 'edgcpp/compiler' && |
| 64 | + github.event_name != 'pull_request' && |
| 65 | + github.ref == 'refs/heads/main' |
| 66 | + runs-on: ubuntu-latest |
| 67 | + timeout-minutes: 5 |
| 68 | + steps: |
| 69 | + - name: Trigger the edgcpp.org site build |
| 70 | + env: |
| 71 | + GH_TOKEN: ${{ secrets.SITE_DISPATCH_TOKEN }} |
| 72 | + run: | |
| 73 | + if [ -z "$GH_TOKEN" ]; then |
| 74 | + echo "::warning::SITE_DISPATCH_TOKEN is not set, so" \ |
| 75 | + "https://edgcpp.org/dev/doc/ was not updated." |
| 76 | + exit 0 |
| 77 | + fi |
| 78 | + gh workflow run build_and_deploy.yml \ |
| 79 | + --repo edgcpp/edgcpp.github.io --ref develop |
0 commit comments