Repository navigation
165 lines (149 loc) · 6 KB
/
Copy pathdocs.yaml
File metadata and controls
165 lines (149 loc) · 6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# 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
timeout-minutes: 60
permissions:
contents: read
steps:
- name: Checkout docs sources
uses: actions/checkout@v7
with:
persist-credentials: false
- 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: Upload generated site
uses: ./.github/actions/upload-artifact-retry
with:
name: comet-docs-site
path: docs/build/html/
retention-days: 1
include-hidden-files: true
if-no-files-found: error
deploy-docs:
name: Deploy docs
needs: build-docs
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: write
steps:
- name: Checkout asf-site branch
uses: actions/checkout@v7
with:
ref: asf-site
path: asf-site
- name: Checkout trusted site metadata
uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
path: trusted
sparse-checkout: |
/.asf.yaml
/.github/actions/download-artifact-retry/
sparse-checkout-cone-mode: false
persist-credentials: false
- name: Download generated site
uses: ./trusted/.github/actions/download-artifact-retry
with:
name: comet-docs-site
path: site-output
- name: Copy & push the generated HTML
run: |
set -x
cd asf-site/
rsync \
-a \
--delete \
--exclude '/.git' \
--exclude '/.asf.yaml' \
--exclude '/.nojekyll' \
../site-output/ \
./
rm -f .asf.yaml .nojekyll
cp ../trusted/.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