Skip to content

Commit 598ae9e

Browse files
authored
ci: publish docs site to datafusion.apache.org/java/ (#26)
1 parent f61b10f commit 598ae9e

2 files changed

Lines changed: 101 additions & 0 deletions

File tree

‎.asf.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,9 @@ github:
5353
allow_update_branch: true
5454
allow_auto_merge: true
5555
del_branch_on_merge: true
56+
57+
# publishes the content of the `asf-site` branch to
58+
# https://datafusion.apache.org/java/
59+
publish:
60+
whoami: asf-site
61+
subdir: java

‎.github/workflows/docs.yaml‎

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Deploy DataFusion Java site
19+
20+
on:
21+
push:
22+
branches:
23+
- main
24+
paths:
25+
- .asf.yaml
26+
- .github/workflows/docs.yaml
27+
- docs/**
28+
pull_request:
29+
branches:
30+
- main
31+
paths:
32+
- .asf.yaml
33+
- .github/workflows/docs.yaml
34+
- docs/**
35+
36+
permissions:
37+
contents: write
38+
39+
jobs:
40+
build-docs:
41+
name: Build docs
42+
if: ${{ startsWith(github.repository, 'apache/') }}
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Checkout docs sources
46+
uses: actions/checkout@v4
47+
48+
- name: Checkout asf-site branch
49+
if: github.event_name == 'push'
50+
uses: actions/checkout@v4
51+
with:
52+
ref: asf-site
53+
path: asf-site
54+
55+
- name: Setup Python
56+
uses: actions/setup-python@v5
57+
with:
58+
python-version: "3.10"
59+
60+
- name: Install dependencies
61+
run: |
62+
set -x
63+
python3 -m venv venv
64+
source venv/bin/activate
65+
pip install --upgrade pip
66+
pip install -r docs/requirements.txt
67+
68+
- name: Build docs
69+
run: |
70+
set -x
71+
source venv/bin/activate
72+
cd docs
73+
./build.sh
74+
75+
- name: Copy & push the generated HTML
76+
if: github.event_name == 'push'
77+
run: |
78+
set -x
79+
cd asf-site
80+
rsync \
81+
-a \
82+
--delete \
83+
--exclude '/.git/' \
84+
../docs/build/html/ \
85+
./
86+
cp ../.asf.yaml .
87+
touch .nojekyll
88+
git status --porcelain
89+
if [ -n "$(git status --porcelain)" ]; then
90+
git config user.name "github-actions[bot]"
91+
git config user.email "github-actions[bot]@users.noreply.github.com"
92+
git add --all
93+
git commit -m "Publish built docs triggered by ${{ github.sha }}"
94+
git push || git push --force
95+
fi

0 commit comments

Comments
 (0)