From d8e89932068b18521724eab3c042ba3ab8fb90a0 Mon Sep 17 00:00:00 2001 From: Chesnay Schepler Date: Thu, 10 Nov 2022 09:20:55 +0100 Subject: [PATCH] [FLINK-29957][docs] Rework connector docs integration --- docs/config.toml | 2 +- docs/setup_docs.sh | 28 ++++++++++++++++++++++------ docs/themes/.gitignore | 1 + 3 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 docs/themes/.gitignore diff --git a/docs/config.toml b/docs/config.toml index d376b7dff8ecb..0df80cec67db4 100644 --- a/docs/config.toml +++ b/docs/config.toml @@ -112,7 +112,7 @@ pygmentsUseClasses = true [module] [[module.imports]] - path = 'github.com/apache/flink-connector-elasticsearch/docs' + path = 'connectors' [[module.imports.mounts]] source = 'content' target = 'content' diff --git a/docs/setup_docs.sh b/docs/setup_docs.sh index 34f3d59d99c53..164e5b3967422 100755 --- a/docs/setup_docs.sh +++ b/docs/setup_docs.sh @@ -35,9 +35,25 @@ echo "Created temporary file" $goModFileLocation/go.mod # Make Hugo retrieve modules which are used for externally hosted documentation currentBranch=$(git rev-parse --abbrev-ref HEAD) -if [[ ! "$currentBranch" =~ ^release- ]] || [[ -z "$currentBranch" ]]; then - # If the current branch is master or not provided, get the documentation from the main branch - $(command -v hugo) mod get -u github.com/apache/flink-connector-elasticsearch/docs@main - # Since there's no documentation yet available for a release branch, - # we only get the documentation from the main branch -fi +function integrate_connector_docs { + connector=$1 + ref=$2 + git clone --single-branch --branch ${ref} https://github.com/apache/flink-connector-${connector} + theme_dir="../themes/connectors" + mkdir -p "${theme_dir}" + rsync -a flink-connector-${connector}/docs/content* "${theme_dir}/" +} + +# Integrate the connector documentation + +rm -rf themes/connectors/* +rm -rf tmp +mkdir tmp +cd tmp + +# Since there's no documentation yet available for a release branch, +# we only get the documentation from the main branch +integrate_connector_docs elasticsearch main + +cd .. +rm -rf tmp diff --git a/docs/themes/.gitignore b/docs/themes/.gitignore new file mode 100644 index 0000000000000..5cf335a67c713 --- /dev/null +++ b/docs/themes/.gitignore @@ -0,0 +1 @@ +connectors/