⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 31 additions & 9 deletions scripts/import_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
set -euo pipefail

SOURCE_REPO="https://github.com/cloudnative-pg/cloudnative-pg.git"
ROOT_DIR=$(cd "$(dirname "$0")/../"; pwd)
WEBSITE_DIR=${ROOT_DIR}/website
SOURCE_DOCS_PATH="docs/src"
TMP_BASE="$(mktemp -d)"
trap 'rm -rf "$TMP_BASE"' EXIT
Expand Down Expand Up @@ -106,24 +108,44 @@ fi
# ===== MAIN BRANCH =====
if [[ "$IS_MAIN" == true ]]; then
echo "Copying imported docs -> ./website/docs"
mkdir -p ./website/docs
rsync -av --delete "$SOURCE_PATH/" --exclude "css" ./website/docs/
mkdir -p ${WEBSITE_DIR}/docs
rsync -av --delete "$SOURCE_PATH/" --exclude "css" ${WEBSITE_DIR}/docs/

echo "Updated ./docs from main — import completed."
exit 0
fi
# ===== VERSION TAG =====
VERSIONS_JSON="./website/versions.json"
VERSIONS_CONFIG="./website/versions_config.json"
DOCUSAURUS_CONFIG="./website/docusaurus.config.ts"
TARGET_DIRECTORY="./website/versioned_docs/version-${VERSION_DIR}"
VERSIONS_JSON="${WEBSITE_DIR}/versions.json"
VERSIONS_CONFIG="${WEBSITE_DIR}/versions_config.json"
DOCUSAURUS_CONFIG="${WEBSITE_DIR}/docusaurus.config.ts"
TARGET_DIRECTORY="${WEBSITE_DIR}/versioned_docs/version-${VERSION_DIR}"

echo "Copying imported docs -> ${TARGET_DIRECTORY}"
rsync -av --delete "$SOURCE_PATH/" --exclude "css" "${TARGET_DIRECTORY}"

# Create autogenerated sidebar configuration for this version if it doesn't exist
SIDEBAR_TARGET_DIR="${WEBSITE_DIR}/versioned_sidebars"
SIDEBAR_TARGET_FILE="$SIDEBAR_TARGET_DIR/version-${VERSION_DIR}-sidebars.json"

if [[ ! -f "$SIDEBAR_TARGET_FILE" ]]; then
echo "Creating autogenerated sidebar config for version ${VERSION_DIR}"
mkdir -p "$SIDEBAR_TARGET_DIR"
cat > "$SIDEBAR_TARGET_FILE" <<'SIDEBAR_EOF'
{
"docs": [
{
"type": "autogenerated",
"dirName": "."
}
]
}
SIDEBAR_EOF
else
echo "Sidebar config for version ${VERSION_DIR} already exists, keeping it"
fi

# Add the new version to versions.json if not already present
if ! grep -q "\"${VERSION_DIR}\"" versions.json 2>/dev/null; then
# Import the new version in the correct folder
cp "./website/sidebar_config.json" "./website/versioned_sidebars/version-${VERSION_DIR}-sidebars.json"
if ! grep -q "\"${VERSION_DIR}\"" "$VERSIONS_JSON" 2>/dev/null; then
jq --arg version "$VERSION_DIR" \
'. = [$version] + . | unique' \
"$VERSIONS_JSON" > "${VERSIONS_JSON}.tmp" && \
Expand Down
7 changes: 7 additions & 0 deletions website/docs/appendixes/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "Appendixes",
"position": 600,
"link": {
"type": "generated-index"
}
}
7 changes: 7 additions & 0 deletions website/docs/cncf-projects/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "CNCF Projects Integrations",
"position": 590,
"link": {
"type": "generated-index"
}
}
75 changes: 2 additions & 73 deletions website/sidebar_config.json
Original file line number Diff line number Diff line change
@@ -1,79 +1,8 @@
{
"docs": [
"index",
"before_you_start",
"use_cases",
"architecture",
"installation_upgrade",
"quickstart",
"image_catalog",
"bootstrap",
"database_import",
"security",
"instance_manager",
"scheduling",
"resource_management",
"failure_modes",
"rolling_update",
"replication",
"logical_replication",
"backup",
"wal_archiving",
"recovery",
"service_management",
"postgresql_conf",
"declarative_role_management",
"declarative_database_management",
"tablespaces",
"operator_conf",
"cluster_conf",
"storage",
"labels_annotations",
"monitoring",
"logging",
"certificates",
"ssl_connections",
"applications",
"connection_pooling",
"replica_cluster",
"kubernetes_upgrade",
"postgres_upgrades",
"kubectl-plugin",
"failover",
"troubleshooting",
"fencing",
"declarative_hibernation",
"postgis",
"e2e",
"container_images",
"imagevolume_extensions",
"cnpg_i",
"operator_capability_levels",
"controller",
"samples",
"networking",
"benchmarking",
"faq",
"cloudnative-pg.v1",
"supported_releases",
"preview_version",
"release_notes",
{
"type": "category",
"label": "CNCF Projects Integrations",
"items": [
"cncf-projects/external-secrets",
"cncf-projects/cilium"
]
},
{
"type": "category",
"label": "Appendixes",
"items": [
"appendixes/backup_volumesnapshot",
"appendixes/backup_barmanobjectstore",
"appendixes/object_stores"
]
"type": "autogenerated",
"dirName": "."
}
]
}