diff --git a/website/build-versions.sh b/website/build-versions.sh index 63264488af..8f7200cb05 100755 --- a/website/build-versions.sh +++ b/website/build-versions.sh @@ -51,22 +51,22 @@ function createVersionedDocs() ( # Workaround for broken links in versions 4.4.0 and before printf '%s\n%s\n' "$target_version" "$version" | sort -V | head -n1 - if [[ $? -eq 0 ]]; then - logInner "Version is 4.4.0 or less, applying workaround for broken links and v3 upgrade" - gnu_sed=sed - if [[ "$(uname)" == "Darwin" ]]; then - gnu_sed=gsed - fi - echo $gnu_sed - # Fix links to cloud-foundry.md - find $checkedOutRepo/website/versioned_docs/version-$label -type f -name "*.md" -exec ${gnu_sed} -i 's/cloud-foundry\/cloud-foundry/cloud-foundry\/cloud-foundry.md/g' {} \; - # Fix other links to cloud-foundry.md - find $checkedOutRepo/website/versioned_docs/version-$label -type f -name "*.md" -exec ${gnu_sed} -i 's/](cloud-foundry)/(cloud-foundry.md)/g' {} \; - # Escape commit signing in contributers guide (v3 upgrade) - find $checkedOutRepo/website/versioned_docs/version-$label -type f -name "*.md" -exec ${gnu_sed} -i 's/ Signed-off-by: Joe Smith /```\nSigned-off-by: Joe Smith \n```/g' {} \; - # Remove versions from sidebars (v3 upgrade) - find $checkedOutRepo/website/versioned_sidebars -type f -name "*.json" -exec ${gnu_sed} -i 's/version-[0-9]\.[0-9]\.[0-9]\///g' {} \; - fi + if [[ $? -eq 0 ]]; then + logInner "Version is 4.4.0 or less, applying workaround for broken links and v3 upgrade" + gnu_sed=sed + if [[ "$(uname)" == "Darwin" ]]; then + gnu_sed=gsed + fi + echo $gnu_sed + # Fix links to cloud-foundry.md + find $checkedOutRepo/website/versioned_docs/version-$label -type f -name "*.md" -exec ${gnu_sed} -i 's/cloud-foundry\/cloud-foundry/cloud-foundry\/cloud-foundry.md/g' {} \; + # Fix other links to cloud-foundry.md + find $checkedOutRepo/website/versioned_docs/version-$label -type f -name "*.md" -exec ${gnu_sed} -i 's/](cloud-foundry)/(cloud-foundry.md)/g' {} \; + # Escape commit signing in contributers guide (v3 upgrade) + find $checkedOutRepo/website/versioned_docs/version-$label -type f -name "*.md" -exec ${gnu_sed} -i 's/ Signed-off-by: Joe Smith /```\nSigned-off-by: Joe Smith \n```/g' {} \; + # Remove versions from sidebars (v3 upgrade) + find $checkedOutRepo/website/versioned_sidebars -type f -name "*.json" -exec ${gnu_sed} -i 's/version-[0-9]\.[0-9]\.[0-9]\///g' {} \; + fi # End of workaround cp -r $checkedOutRepo/website/versioned_docs/version-$label $currentWebsite/versioned_docs