This is an automated email from the ASF dual-hosted git repository.
czweng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-paimon-website.git
The following commit(s) were added to refs/heads/master by this push:
new 27fb57a Add github workflow for building website and document
27fb57a is described below
commit 27fb57a22a0fb9497db76f970639b0f6ea262a7f
Author: tsreaper <[email protected]>
AuthorDate: Fri Mar 17 16:50:58 2023 +0800
Add github workflow for building website and document
---
.github/workflows/build.yml | 95 +++++++++++++++++++++++++++++++++++++++++++++
.github/workflows/docs.sh | 53 +++++++++++++++++++++++++
2 files changed, 148 insertions(+)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..7165995
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,95 @@
+# 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" "0.3") # defines what versions of document should be
updated
+ latest_version: "0.3" # defines what version docs/latest links to
+
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: '0 0 * * *' # deploy every day
+
+jobs:
+ build-website:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Move 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: Copy main site
+ run: |
+ git checkout master
+ git branch -D asf-site
+ git checkout --orphan asf-site
+
+ - name: Move back docs directory
+ run: |
+ mkdir docs
+ cp -r /tmp/docs/* docs
+
+ - name: Clone Paimon repo
+ run: git clone https://github.com/apache/incubator-paimon.git
/tmp/paimon
+
+ - name: Build docs
+ run: |
+ declare -a versions=${{ env.versions }}
+ current_dir=$(pwd)
+ cp ./.github/workflows/docs.sh /tmp/paimon/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
+ docker run --rm --volume "$PWD:/root/paimon"
chesnay/flink-ci:java_8_11 bash -c "cd /root/paimon && . ./docs.sh"
+ # copy document to target directory
+ cp -r docs/target/* "$current_dir"/docs/"$version"
+ # clean up
+ git reset --hard HEAD
+ cd "$current_dir"
+ done
+
+ - name: Copy latest version
+ run: |
+ latest_version=${{ env.latest_version }}
+ rm -rf docs/latest
+ cp -r docs/"$latest_version" docs/latest
+
+ - name: Push to github
+ run: |
+ git add -A
+ git config --global user.name 'GitHub Actions'
+ git config --global user.email '[email protected]'
+ git commit -m "Build website and document"
+ git push -f origin asf-site
diff --git a/.github/workflows/docs.sh b/.github/workflows/docs.sh
new file mode 100644
index 0000000..8257093
--- /dev/null
+++ b/.github/workflows/docs.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+################################################################################
+# 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.
+################################################################################
+set -e
+
+mvn --version
+java -version
+javadoc -J-version
+
+# setup hugo
+HUGO_REPO=https://github.com/gohugoio/hugo/releases/download/v0.80.0/hugo_extended_0.80.0_Linux-64bit.tar.gz
+HUGO_ARTIFACT=hugo_extended_0.80.0_Linux-64bit.tar.gz
+if ! curl --fail -OL $HUGO_REPO ; then
+ echo "Failed to download Hugo binary"
+ exit 1
+fi
+tar -zxvf $HUGO_ARTIFACT
+git submodule update --init --recursive
+# generate docs into docs/target
+./hugo -v --source docs --destination target
+if [ $? -ne 0 ]; then
+ echo "Error building the docs"
+ exit 1
+fi
+
+# build Paimon; required for Javadoc step
+mvn clean install -B -DskipTests
+
+# build java/scala docs
+mkdir -p docs/target/api
+mvn javadoc:aggregate -B \
+ -DadditionalJOption="-Xdoclint:none --allow-script-in-comments" \
+ -Dmaven.javadoc.failOnError=false \
+ -Dcheckstyle.skip=true \
+ -Dspotless.check.skip=true \
+ -Denforcer.skip=true \
+ -Dheader="<a href=\"http://paimon.apache.org/\" target=\"_top\"><h1>Back
to Paimon Website</h1></a> <script>var
_paq=window._paq=window._paq||[];_paq.push([\"disableCookies\"]),_paq.push([\"setDomains\",[\"*.paimon.apache.org\"]]),_paq.push([\"trackPageView\"]),_paq.push([\"enableLinkTracking\"]),function(){var
u=\"//matomo.privacy.apache.org/\";_paq.push([\"setTrackerUrl\",u+\"matomo.php\"]),_paq.push([\"setSiteId\",\"1\"]);var
d=document, g=d.createElement('script'), s=d.getElement [...]
+mv target/site/apidocs docs/target/api/java