-
Notifications
You must be signed in to change notification settings - Fork 25
179 lines (156 loc) · 5.59 KB
/
Copy pathbuild.yml
File metadata and controls
179 lines (156 loc) · 5.59 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# 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: "Build website and document"
env:
versions: ("master" "1.4") # defines what versions of document should be updated
latest_version: "1.4" # defines what version docs/latest links to
base_href: "https://paimon.apache.org/" # website base href
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # deploy every day
jobs:
build-website:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Set up pnpm v9
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Set up Node.js 20 LTS
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Enable yarn
run: corepack enable yarn
- name: Copy out old docs directory
run: |
git fetch origin asf-site:asf-site
git checkout asf-site
if [[ -d docs ]]
then
cp -r docs /tmp/docs
else
mkdir /tmp/docs
fi
- name: Create asf-site branch
run: |
git checkout master
git branch -D asf-site
git checkout --orphan asf-site
- name: Copy back docs directory
run: cp -r /tmp/docs docs
- name: Build Website
run: |
# move to temporary directory for building website
mkdir /tmp/main
mv * /tmp/main
cd /tmp/main
# build website
npm config --global set registry https://registry.npmmirror.com/
pnpm install
pnpm run build --base-href="${{ env.base_href }}"
- name: Move out output
run: |
mv /tmp/docs .
mv /tmp/main/dist/browser/* .
rm -rf /tmp/main
- name: Clone Paimon repo
run: git clone https://github.com/apache/paimon.git /tmp/paimon
- name: Build docs
run: |
declare -a versions=${{ env.versions }}
current_dir=$(pwd)
cp ./.github/workflows/docs.sh /tmp/docs.sh
for version in "${versions[@]}"
do
# delete old document
rm -rf docs/"$version"
mkdir docs/"$version"
# build new document
cd /tmp/paimon
git checkout master
if [ "$version" != "master" ]
then
git checkout release-"$version"
fi
# master or version >= 1.5 uses Docusaurus, otherwise Hugo
if [ "$version" == "master" ] || [ "$(echo "$version" | awk -F. '{print ($1 * 100 + $2)}')" -ge 105 ]; then
cd docs
sed -i "s|baseUrl: '/docs/master/'|baseUrl: '/docs/$version/'|g" docusaurus.config.js
yarn install --frozen-lockfile
yarn build
cp -r build/* "$current_dir"/docs/"$version"
cd /tmp/paimon
else
. /tmp/docs.sh
cp -r docs/target/* "$current_dir"/docs/"$version"
fi
# clean up
git reset --hard HEAD
git clean -fdx
cd "$current_dir"
done
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Clone Paimon Rust repo
run: git clone https://github.com/apache/paimon-rust.git /tmp/paimon-rust
- name: Build Paimon Rust docs
run: |
pip install mkdocs-material
cd /tmp/paimon-rust/docs
mkdocs build -d /tmp/paimon-rust-site
cd $GITHUB_WORKSPACE
rm -rf docs/rust
mkdir -p docs/rust
cp -r /tmp/paimon-rust-site/* docs/rust/
- name: Clone Paimon CPP repo
run: git clone --depth 1 https://github.com/apache/paimon-cpp.git /tmp/paimon-cpp
- name: Build Paimon CPP docs
run: |
sudo apt-get update
sudo apt-get install -y doxygen
pip install -r /tmp/paimon-cpp/docs/requirements.txt
cd /tmp/paimon-cpp/apidoc
doxygen
cd /tmp/paimon-cpp/docs
make html
cd $GITHUB_WORKSPACE
rm -rf docs/cpp
mkdir -p docs/cpp
cp -r /tmp/paimon-cpp/docs/_build/html/* docs/cpp/
- name: Clone Paimon Mosaic repo
run: git clone --depth 1 https://github.com/apache/paimon-mosaic.git /tmp/paimon-mosaic
- name: Build Paimon Mosaic docs
run: |
rm -rf docs/mosaic
mkdir -p docs/mosaic
cp -r /tmp/paimon-mosaic/docs/* docs/mosaic/
- name: Push to github
run: |
git add -A
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
git commit -m "Build website and document"
git push -f origin asf-site