mirror of
https://github.com/kubevela/kubevela.git
synced 2026-04-24 11:36:49 +00:00
fix release website (#1819)
This commit is contained in:
2
.github/workflows/check-docs.yml
vendored
2
.github/workflows/check-docs.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
with:
|
||||
python-version: '3.7'
|
||||
- name: Clean md files
|
||||
run: python ./hack/website/clean-md.py ./docs/en
|
||||
run: python ./hack/website/format.py markdown ./docs/en
|
||||
- name: Test Build
|
||||
env:
|
||||
VERSION: ${{ github.ref }}
|
||||
|
||||
2
.github/workflows/release-docs.yaml
vendored
2
.github/workflows/release-docs.yaml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
with:
|
||||
python-version: '3.7'
|
||||
- name: Clean md files
|
||||
run: python ./hack/website/clean-md.py ./docs/en
|
||||
run: python ./hack/website/format.py markdown ./docs/en
|
||||
- name: Sync to kubevela.io Repo
|
||||
env:
|
||||
SSH_DEPLOY_KEY: ${{ secrets.GH_PAGES_DEPLOY }}
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -132,7 +132,7 @@ jobs:
|
||||
with:
|
||||
python-version: "3.7"
|
||||
- name: Clean md files
|
||||
run: python ./hack/website/clean-md.py ./docs/en
|
||||
run: python ./hack/website/format.py markdown ./docs/en
|
||||
- name: Sync release to kubevela.io Repo
|
||||
env:
|
||||
SSH_DEPLOY_KEY: ${{ secrets.GH_PAGES_DEPLOY }}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import re
|
||||
import os
|
||||
import ast
|
||||
import sys
|
||||
import json
|
||||
|
||||
|
||||
def convert_link(md):
|
||||
@@ -22,16 +24,34 @@ def convert_link(md):
|
||||
f.write(data)
|
||||
|
||||
|
||||
def main(path):
|
||||
def format_markdown(path):
|
||||
files = os.walk(path)
|
||||
for path, dir_list,file_list in files:
|
||||
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) != 2:
|
||||
if len(sys.argv) != 3:
|
||||
sys.exit(1)
|
||||
main(sys.argv[1])
|
||||
|
||||
fmt_type = sys.argv[1]
|
||||
path = sys.argv[2]
|
||||
if fmt_type == "markdown":
|
||||
format_markdown(path)
|
||||
|
||||
if fmt_type == "json":
|
||||
format_json(path)
|
||||
@@ -18,13 +18,13 @@
|
||||
set -e
|
||||
|
||||
checkDocusaurus(){
|
||||
if [ --d $1 ]; then
|
||||
echo "generate docs failed"
|
||||
if [ ! -d $1 ]; then
|
||||
echo "generate docs failed"
|
||||
exit 1;
|
||||
else
|
||||
count=`ls $1 | wc -w`
|
||||
if [ "$count" > "0" ]; then
|
||||
echo "generate docs failed"
|
||||
echo "generate docs success"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -66,6 +66,8 @@ then
|
||||
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
|
||||
@@ -98,6 +100,8 @@ then
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user