diff --git a/hack/website/helpers.sh b/hack/website/helpers.sh new file mode 100644 index 000000000..6397b11ca --- /dev/null +++ b/hack/website/helpers.sh @@ -0,0 +1,30 @@ +#!/bin/bash -l +# +# Copyright 2021. The KubeVela Authors. +# +# Licensed 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 + +checkDocusaurus(){ + if [ --d $1 ]; then + echo "generate docs failed" + exit 1; + else + count=`ls $1 | wc -w` + if [ "$count" > "0" ]; then + echo "generate docs failed" + fi + fi +} \ No newline at end of file diff --git a/hack/website/release.sh b/hack/website/release.sh index 2e124327b..365b9bf1a 100644 --- a/hack/website/release.sh +++ b/hack/website/release.sh @@ -17,6 +17,8 @@ set -e +source hack/website/helpers.sh + if [[ -n "$SSH_DEPLOY_KEY" ]] then mkdir -p ~/.ssh @@ -76,6 +78,7 @@ then yarn run docusaurus docs:version $version git checkout docusaurus.config.js rm docusaurus.config.js.bak + checkDocusaurus versioned_docs/version-${version} fi # Check for release branch update only @@ -107,6 +110,7 @@ then yarn run docusaurus docs:version $version git checkout docusaurus.config.js rm docusaurus.config.js.bak + checkDocusaurus versioned_docs/version-${version} fi diff --git a/hack/website/test-build.sh b/hack/website/test-build.sh index 30c349650..526618f1c 100644 --- a/hack/website/test-build.sh +++ b/hack/website/test-build.sh @@ -17,6 +17,8 @@ set -e +source hack/website/helpers.sh + docs_path="./docs" git clone --single-branch --depth 1 https://github.com/oam-dev/kubevela.io.git git-page @@ -75,4 +77,5 @@ then fi yarn run docusaurus docs:version $version + checkDocusaurus versioned_docs/version-${version} fi \ No newline at end of file