Chore: remove hack/website as docs moved to kubevela.io repo (#3197)

Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>
This commit is contained in:
Jianbo Sun
2022-02-08 16:24:26 +08:00
committed by GitHub
parent 68ada429f0
commit 0d8a9fc0de
7 changed files with 0 additions and 381 deletions

View File

@@ -1,8 +0,0 @@
FROM node:16.9.0
WORKDIR /workspace
COPY website-dev.sh /workspace
RUN git init kubevela.io
ENTRYPOINT [ "bash", "website-dev.sh" ]
CMD [ "-t", "start" ]

View File

@@ -1,26 +0,0 @@
#!/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.
#
if [ ! -d "./git-page" ]; then
git clone --single-branch --depth 1 https://github.com/oam-dev/kubevela.io.git git-page
fi
rm -r git-page/docs
rm git-page/sidebars.js
cat docs/sidebars.js > git-page/sidebars.js
cp -R docs/en git-page/docs
cd git-page && yarn install && yarn start

View File

@@ -1,57 +0,0 @@
import re
import os
import ast
import sys
import json
def convert_link(md):
data = ""
with open(md, "r") as f:
data = f.read()
url_arr = re.findall(r'(\[(.*?)\]\((.*?)\))', data)
for url in url_arr:
if url[2].startswith("http") or url[2].startswith("https"):
continue
if ".md" in url[2] or ".mdx" in url[2]:
new_path = url[2].replace(".mdx", "")
new_path = new_path.replace(".md", "")
new_url = "[{}]({})".format(url[1], new_path)
data = data.replace(url[0], new_url)
print(f"convert {url[0]} to {new_url}")
with open(md, "w") as f:
f.write(data)
def format_markdown(path):
files = os.walk(path)
for path, dir_list, file_list in files:
for file_name in file_list:
file_path = os.path.join(path, file_name)
if file_path[-3:] == ".md" or file_path[-4:] == ".mdx":
convert_link(file_path)
def format_json(file):
data = ""
with open(file, "r") as f:
content = f.read()
data = ast.literal_eval(re.sub(r"(\w+)=", r"'\1':", content))
print(f"format versions.json: {data}")
with open(file, "w") as f:
f.write(json.dumps(data))
if __name__ == "__main__":
if len(sys.argv) != 3:
sys.exit(1)
fmt_type = sys.argv[1]
path = sys.argv[2]
if fmt_type == "markdown":
format_markdown(path)
if fmt_type == "json":
format_json(path)

View File

@@ -1,30 +0,0 @@
#!/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 success"
fi
fi
}

View File

@@ -1,129 +0,0 @@
#!/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
source hack/website/helpers.sh
if [[ -n "$SSH_DEPLOY_KEY" ]]
then
mkdir -p ~/.ssh
echo "$SSH_DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
fi
echo "git clone"
git config --global user.email "kubevela.bot@aliyun.com"
git config --global user.name "kubevela-bot"
git clone --single-branch --depth 1 git@github.com:oam-dev/kubevela.io.git git-page
echo "sidebars updates"
cat docs/sidebars.js > git-page/sidebars.js
echo "clear en docs"
rm -r git-page/docs/*
#echo "clear zh docs"
#rm -r git-page/i18n/zh/docusaurus-plugin-content-docs/*
echo "update docs"
cp -R docs/en/* git-page/docs/
#cp -R docs/zh-CN/* git-page/i18n/zh/docusaurus-plugin-content-docs/
echo "git push"
cd git-page
# Check for release created only
SUB='v'
if [[ "$VERSION" == "$SUB"* ]]
then
# vx.y.z -> vx.y
sub="."
major="$(cut -d"$sub" -f1 <<<"$VERSION")"
minor="$(cut -d"$sub" -f2 <<<"$VERSION")"
version=${major}.${minor}
echo "updating website for version $version"
sed -i.bak "s#lastVersion: '${version}'#lastVersion: 'current'#g" docusaurus.config.js
if grep -q $version versions.json; then
rm -r versioned_docs/version-${version}/
rm versioned_sidebars/version-${version}-sidebars.json
sed -i.bak "/${version}/d" versions.json
rm versions.json.bak
fi
python ../hack/website/format.py json versions.json
yarn add nodejieba
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
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
SUB='release-'
if [[ "$VERSION" == *"$SUB"* ]]
then
# release-x.y -> vx.y
version=$(echo $VERSION|sed -e 's/\/*.*\/*-/v/g')
echo "updating website for version $version"
sed -i.bak "s#lastVersion: '${version}'#lastVersion: 'current'#g" docusaurus.config.js
if grep -q $version versions.json; then
rm -r versioned_docs/version-${version}/
rm versioned_sidebars/version-${version}-sidebars.json
sed -i.bak "/${version}/d" versions.json
rm versions.json.bak
fi
python ../hack/website/format.py json versions.json
yarn add nodejieba
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
yarn run docusaurus docs:version $version
git checkout docusaurus.config.js
rm docusaurus.config.js.bak
checkDocusaurus versioned_docs/version-${version}
fi
if git diff --quiet
then
echo "nothing need to push, finished!"
else
git add .
git commit -m "sync commit $COMMIT_ID from kubevela-$VERSION"
git push origin main
fi

View File

@@ -1,81 +0,0 @@
#!/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
source hack/website/helpers.sh
docs_path="./docs"
git clone --single-branch --depth 1 https://github.com/oam-dev/kubevela.io.git git-page
echo "sidebars updates"
cat ${docs_path}/sidebars.js > git-page/sidebars.js
echo "clear en docs"
rm -r git-page/docs/*
# echo "clear zh docs"
# rm -r git-page/i18n/zh/docusaurus-plugin-content-docs/*
echo "update docs"
cp -R ${docs_path}/en/* git-page/docs/
# cp -R ${docs_path}/zh-CN/* git-page/i18n/zh/docusaurus-plugin-content-docs/
echo "check docs"
cd git-page
echo "install node package"
yarn add nodejieba
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
echo "run build"
npm run build
# Check for release only
SUB='release-'
if [[ "$VERSION" == *"$SUB"* ]]
then
# release-x.y -> vx.y
version=$(echo $VERSION|sed -e 's/\/*.*\/*-/v/g')
echo "updating website for version $version"
if grep -q $version versions.json; then
rm -r versioned_docs/version-${version}/
rm versioned_sidebars/version-${version}-sidebars.json
sed -i.bak "/${version}/d" versions.json
rm versions.json.bak
fi
yarn add nodejieba
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
yarn run docusaurus docs:version $version
checkDocusaurus versioned_docs/version-${version}
fi

View File

@@ -1,50 +0,0 @@
#!/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.
#
git config --global user.email "kubevela.bot@aliyun.com"
git config --global user.name "kubevela-bot"
echo "update kubevela.io"
cd kubevela.io
git config core.sparsecheckout true
git remote add origin https://github.com/oam-dev/kubevela.io.git
echo "*" >> .git/info/sparse-checkout
echo "!/docs/**" >> .git/info/sparse-checkout
echo "!/sidebars.js" >> .git/info/sparse-checkout
git pull --depth 1 origin main
while getopts "t:" arg
do
case $arg in
t)
if [ $OPTARG == "start" ];
then
echo "start docs"
yarn install && yarn start --host 0.0.0.0 --port 3000
fi
if [ $OPTARG == "build" ];
then
echo "build docs"
yarn install && yarn run build
fi
;;
?)
echo "unkonw argument"
exit 1
;;
esac
done