| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| name: Deploy DataFusion Comet site | |
| # Reusable: invoked by ci.yml. Triggering and path filters live in the | |
| # umbrella workflow. | |
| on: | |
| workflow_call: | |
| jobs: | |
| build-docs: | |
| name: Build docs | |
| if: ${{ startsWith(github.repository, 'apache/') }} | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout docs sources | |
| uses: actions/checkout@v7 | |
| - name: Checkout asf-site branch | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: asf-site | |
| path: asf-site | |
| - name: Setup Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.10" | |
| # No `cache: 'maven'`: build.sh builds four Spark profiles, so that entry | |
| # ran to 2.5 GB, read by this job alone, and it pushed the entries the | |
| # merge-queue builds depend on out of the repository's 10 GB budget. The | |
| # site deploy runs after the merge and nothing waits on it, so fetching | |
| # the Maven dependencies here is the cheaper side of that trade. See | |
| # issue #6387. | |
| - name: Setup Java | |
| uses: actions/setup-java@v6 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Setup Node | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: '24' | |
| - name: Install mermaid-cli | |
| # Draws the ```mermaid fences into SVG at build time. Without a working mmdc the build | |
| # still succeeds but silently drops every diagram, so it is installed unconditionally. | |
| # See mermaid_output_format in docs/source/conf.py for why the browser cannot draw them. | |
| # Kept identical to the same step in ci.yml's preflight; the version comes from the | |
| # script so the pull-request check and this deploy cannot render with different ones. | |
| run: | | |
| set -eux | |
| npm install --prefix "$RUNNER_TEMP/mermaid" "$(python3 dev/ci/check-mermaid.py --cli-spec)" | |
| # mmdc draws each diagram by driving headless Chrome. puppeteer's postinstall fetches | |
| # that browser, but it catches its own download failures and exits 0, so a flaky fetch | |
| # leaves a green install step and an mmdc that cannot launch. Fetch it again here, | |
| # where a failure is allowed to fail the job. A cache hit makes this a no-op. | |
| npm --prefix "$RUNNER_TEMP/mermaid" exec -- puppeteer browsers install chrome-headless-shell | |
| echo "$RUNNER_TEMP/mermaid/node_modules/.bin" >> "$GITHUB_PATH" | |
| - name: Check mermaid diagrams render | |
| # Preflight ran this on the pull request, but it is the cheap half of the guard and this | |
| # is the run that publishes. Failing here leaves the previous site in place rather than | |
| # replacing a page with a diagram-shaped hole. | |
| run: python3 dev/ci/check-mermaid.py | |
| - name: Install dependencies | |
| run: | | |
| set -x | |
| python3 -m venv venv | |
| source venv/bin/activate | |
| pip install -r docs/requirements.txt | |
| - name: Build docs | |
| run: | | |
| set -x | |
| source venv/bin/activate | |
| cd docs | |
| ./build.sh | |
| - name: Check the diagrams reached the pages | |
| # The other half: mmdc can be healthy and the diagram still not reach the HTML, which is | |
| # what sphinxcontrib-mermaid does with any render error it meets -- a warning, a dropped | |
| # node, and a green build. This runs before the publish step for that reason. | |
| run: python3 dev/ci/check-mermaid.py --built docs/build/html | |
| - name: Copy & push the generated HTML | |
| run: | | |
| set -x | |
| cd asf-site/ | |
| rsync \ | |
| -a \ | |
| --delete \ | |
| --exclude '/.git/' \ | |
| ../docs/build/html/ \ | |
| ./ | |
| cp ../.asf.yaml . | |
| touch .nojekyll | |
| git status --porcelain | |
| if [ "$(git status --porcelain)" != "" ]; then | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add --all | |
| git commit -m 'Publish built docs triggered by ${{ github.sha }}' | |
| git push || git push --force | |
| fi |