This is an automated email from the ASF dual-hosted git repository.

csy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn-website.git


The following commit(s) were added to refs/heads/main by this push:
     new 52431ef  simple build doc (#27)
52431ef is described below

commit 52431ef2dc447f8846bc135ad64f37623b106d4a
Author: cxzl25 <[email protected]>
AuthorDate: Wed Nov 22 16:26:16 2023 +0800

    simple build doc (#27)
    
    * simple build doc
    
    * fix
---
 .github/bin/build_docs.sh   | 48 +++++++++++++++++++++++++++++++++++++++++++++
 .github/workflows/site.yaml | 33 +++----------------------------
 2 files changed, 51 insertions(+), 30 deletions(-)

diff --git a/.github/bin/build_docs.sh b/.github/bin/build_docs.sh
new file mode 100755
index 0000000..01b4397
--- /dev/null
+++ b/.github/bin/build_docs.sh
@@ -0,0 +1,48 @@
+#!/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 -o pipefail
+set -e
+set -x
+
+function exit_with_usage {
+  echo "./github/bin/build_docs.sh <ref_version_name> <doc_link_path>"
+  exit 1
+}
+
+if [ $# -ne 2 ]; then
+  exit_with_usage
+fi
+
+REF_VERSION_NAME="$1"
+DOC_LINK_PATH="$2"
+
+TAR_NAME=${REF_VERSION_NAME##*/}
+DIR_VERSION_NAME=$(echo "$TAR_NAME" | sed -r "s/v*(.*)\.tar\.gz/\1/g")
+TAR_DIR_NAME=incubator-celeborn-$DIR_VERSION_NAME
+
+wget 
"https://github.com/apache/incubator-celeborn/archive/refs/${REF_VERSION_NAME}";
+tar -xzf $TAR_NAME
+cd $TAR_DIR_NAME
+mkdocs build
+cd ..
+mkdir -p docs
+if [ -d docs/$DOC_LINK_PATH ]; then rm -r docs/$DOC_LINK_PATH; fi
+mv $TAR_DIR_NAME/site docs/$DOC_LINK_PATH
+git add .
+git commit -m "docs/$DOC_LINK_PATH"
\ No newline at end of file
diff --git a/.github/workflows/site.yaml b/.github/workflows/site.yaml
index 39aca40..22d1a7e 100644
--- a/.github/workflows/site.yaml
+++ b/.github/workflows/site.yaml
@@ -48,38 +48,11 @@ jobs:
           git add .gitignore
           git commit -m 'gitignore'
       - run: |
-          wget 
https://github.com/apache/incubator-celeborn/archive/refs/heads/main.tar.gz
-          tar -xzf main.tar.gz
-          cd incubator-celeborn-main
-          mkdocs build
-          cd ..
-          mkdir -p docs
-          if [ -d docs/latest ]; then rm -r docs/latest; fi
-          mv incubator-celeborn-main/site docs/latest
-          git add .
-          git commit -m 'docs/main'
+          ./.github/bin/build_docs.sh 'heads/main.tar.gz' 'main'
       - run: |
-          wget 
https://github.com/apache/incubator-celeborn/archive/refs/tags/v0.2.1-incubating.tar.gz
-          tar -xzf v0.2.1-incubating.tar.gz
-          cd incubator-celeborn-0.2.1-incubating
-          mkdocs build
-          cd ..
-          mkdir -p docs
-          if [ -d docs/0.2.1-incubating ]; then rm -r docs/0.2.1-incubating; fi
-          mv incubator-celeborn-0.2.1-incubating/site docs/0.2.1-incubating
-          git add .
-          git commit -m 'docs/0.2.1-incubating'
+          ./.github/bin/build_docs.sh 'tags/v0.2.1-incubating.tar.gz' 
'0.2.1-incubating'
       - run: |
-          wget 
https://github.com/apache/incubator-celeborn/archive/refs/tags/v0.3.1-incubating.tar.gz
-          tar -xzf v0.3.1-incubating.tar.gz
-          cd incubator-celeborn-0.3.1-incubating
-          mkdocs build
-          cd ..
-          mkdir -p docs
-          if [ -d docs/0.3.1-incubating ]; then rm -r docs/0.3.1-incubating; fi
-          mv incubator-celeborn-0.3.1-incubating/site docs/0.3.1-incubating
-          git add .
-          git commit -m 'docs/0.3.1-incubating'
+          ./.github/bin/build_docs.sh 'tags/v0.3.1-incubating.tar.gz' 
'0.3.1-incubating'
       - run: |
           echo 'publish:'           >> .asf.yaml
           echo '  whoami: asf-site' >> .asf.yaml

Reply via email to