Debian Codegraph @

.github/workflows/deploy-docs.yml

raw
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements. See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
7 #
8 # https://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 # For most projects, this workflow file will not need changing; you simply need
16 # to commit it to your repository.
17
18
19 # A Github Actions workflow that builds and copies the website to asf-site branch
20 name: Deploy website
21
22 on:
23 # Runs on pushes targeting the default branch
24 push:
25 branches:
26 - main
27
28 # Allows you to run this workflow manually from the Actions tab
29 workflow_dispatch:
30
31 # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
32 # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
33 concurrency:
34 group: "pages"
35 cancel-in-progress: false
36
37 jobs:
38 build-website:
39 name: Build website
40 runs-on: ubuntu-latest
41 env:
42 HUGO_VERSION: 0.132.1
43 steps:
44 - name: Install Hugo CLI
45 run: |
46 wget -q -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
47 && sudo dpkg -i ${{ runner.temp }}/hugo.deb
48 - name: Install Dart Sass
49 run: sudo snap install dart-sass
50 - name: Checkout
51 uses: actions/checkout@v5
52
53 - name: Install Node.js dependencies
54 working-directory: doc/
55 run: ls -lah && npm ci
56 - name: Build with Hugo
57 working-directory: doc/
58 env:
59 HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
60 HUGO_ENVIRONMENT: production
61 TZ: America/Los_Angeles
62 run: |
63 hugo \
64 --gc \
65 --minify \
66 --destination ${{ runner.temp }}/website \
67 --baseURL "/"
68 - uses: actions/upload-artifact@v4
69 with:
70 name: website
71 path: ${{ runner.temp }}/website
72
73 build-api-c:
74 name: Build C API docs
75 runs-on: ubuntu-latest
76 steps:
77 - name: Checkout
78 uses: actions/checkout@v5
79
80 - name: Build C docs
81 run: |
82 set -x
83 sudo apt-get update -q
84 sudo apt-get install -q -y cmake liblzma-dev libsnappy-dev libjansson-dev zlib1g-dev pkg-config asciidoc source-highlight libsource-highlight-dev
85 cd lang/c
86 ./build.sh clean docs
87 - uses: actions/upload-artifact@v4
88 with:
89 name: api-c
90 path: build/c/docs
91
92 build-api-cpp:
93 name: Build C++ API docs
94 runs-on: ubuntu-latest
95 steps:
96 - name: Checkout
97 uses: actions/checkout@v5
98
99 - name: Build C++ docs
100 run: |
101 set -x
102 sudo apt-get update -q
103 sudo apt-get install -q -y gcc g++ libboost-all-dev cmake doxygen
104 cd lang/c++
105 ./build.sh clean doc
106 - uses: actions/upload-artifact@v4
107 with:
108 name: api-c++
109 path: lang/c++/doc/html
110
111 build-api-csharp:
112 name: Build C# API docs
113 runs-on: ubuntu-latest
114 steps:
115 - name: Checkout
116 uses: actions/checkout@v5
117
118 - name: Build C# docs
119 run: |
120 set -x
121 sudo apt-get update -q
122 sudo apt-get install -q -y wget libzstd-dev libicu-dev doxygen
123 sudo wget https://dot.net/v1/dotnet-install.sh
124 bash ./dotnet-install.sh --channel "8.0" --install-dir "$HOME/.dotnet"
125 cd lang/csharp
126 mkdir -p build/doc
127 doxygen Avro.dox
128 - uses: actions/upload-artifact@v4
129 with:
130 name: api-csharp
131 path: lang/csharp/build/doc/html
132
133 build-api-java:
134 name: Build Java API docs
135 runs-on: ubuntu-latest
136 steps:
137 - name: Checkout
138 uses: actions/checkout@v5
139
140 - name: Cache Local Maven Repository
141 uses: actions/cache@v4
142 with:
143 path: ~/.m2/repository
144 key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
145 restore-keys: |
146 ${{ runner.os }}-maven-
147
148 - name: 'Setup Maven'
149 uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5
150 with:
151 maven-version: 3.9.9
152
153 - name: Setup Temurin JDK
154 uses: actions/setup-java@v5
155 with:
156 distribution: 'temurin'
157 java-version: |
158 11
159 17
160 21
161
162 - name: Build Java docs
163 run: |
164 set -x
165 cd lang/java
166 ./build.sh dist
167 - uses: actions/upload-artifact@v4
168 with:
169 name: api-java
170 path: lang/java/target/reports/apidocs
171
172 build-api-python:
173 name: Build Python API docs
174 runs-on: ubuntu-latest
175 steps:
176 - name: Checkout
177 uses: actions/checkout@v5
178
179 - name: Setup Python
180 uses: actions/setup-python@v5
181 with:
182 python-version: 3.11
183
184 - name: Install tox
185 run: python3 -m pip install tox
186
187 - name: Build docs
188 working-directory: lang/py
189 run: ./build.sh doc
190
191 - uses: actions/upload-artifact@v4
192 with:
193 name: api-python
194 path: lang/py/docs/build/
195
196 build-api-rust:
197 name: Build Rust API docs
198 runs-on: ubuntu-latest
199 steps:
200 - name: Checkout
201 uses: actions/checkout@v5
202 with:
203 repository: 'apache/avro-rs'
204
205 - name: Rust Toolchain
206 uses: dtolnay/rust-toolchain@stable
207 with:
208 toolchain: stable
209
210 - name: Build Rustdocs
211 run: |
212 set -x
213 cargo doc --all-features
214 - uses: actions/upload-artifact@v4
215 with:
216 name: api-rust
217 path: target/doc
218
219
220 push-website:
221 name: Push website
222 needs: [build-website, build-api-c, build-api-cpp, build-api-csharp, build-api-java, build-api-rust, build-api-python]
223 runs-on: ubuntu-latest
224 steps:
225 - name: Checkout
226 uses: actions/checkout@v5
227 with:
228 fetch-depth: 0
229
230 - name: Install dependencies
231 run: |
232 set -x
233 sudo apt-get update -q
234 sudo apt-get install -q -y subversion
235
236 - name: Download website
237 uses: actions/download-artifact@v5
238 with:
239 name: website
240 path: ${{ runner.temp }}/website
241
242 - name: Download api-c
243 uses: actions/download-artifact@v5
244 with:
245 name: api-c
246 path: api-c
247
248 - name: Download api-c++
249 uses: actions/download-artifact@v5
250 with:
251 name: api-c++
252 path: api-c++
253
254 - name: Download api-csharp
255 uses: actions/download-artifact@v5
256 with:
257 name: api-csharp
258 path: api-csharp
259
260 - name: Download api-java
261 uses: actions/download-artifact@v5
262 with:
263 name: api-java
264 path: api-java
265
266 - name: Download api-python
267 uses: actions/download-artifact@v5
268 with:
269 name: api-python
270 path: api-python
271
272 - name: Download api-rust
273 uses: actions/download-artifact@v5
274 with:
275 name: api-rust
276 path: api-rust
277
278 - name: Copy the generated HTML
279 run: |
280 set -x
281
282 WEBSITE_API=${{ runner.temp }}/website/docs/++version++/api
283 mkdir -p $WEBSITE_API/{c,cpp/html,csharp/html,java,py/html,rust}
284
285 mv api-c/* $WEBSITE_API/c/
286 mv api-c++/* $WEBSITE_API/cpp/html/
287 mv api-csharp/* $WEBSITE_API/csharp/html/
288 mv api-java/* $WEBSITE_API/java/
289 mv api-python/* $WEBSITE_API/py/
290 mv api-rust/* $WEBSITE_API/rust/
291 rmdir api-c api-c++ api-csharp api-python api-rust api-java
292
293 - name: Checkout old docs versions from Subversion
294 run: |
295 set -xe
296 svn checkout https://svn.apache.org/repos/asf/avro/site/publish/docs
297 rm -rf docs/.svn
298 cp -R docs/1* ${{ runner.temp }}/website/docs/
299 rm -rf docs
300
301 - name: Push the new website
302 run: |
303 set -ex
304
305 ls -la ${{ runner.temp }}/website/docs/
306
307 git config --global user.email "[email protected]"
308 git config --global user.name "Github Actions"
309 git checkout --orphan asf-site-staging
310
311 git rm -rf *
312
313 mv ${{ runner.temp }}/website/* .
314 echo "publish:
315 whoami: asf-site
316 " > .asf.yaml
317 touch .nojekyll
318 git add --all
319 git commit -m "Publish built website triggered by ${{ github.sha }}"
320 git switch asf-site
321 git reset --hard asf-site-staging
322 git push origin asf-site --force
323