github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/tools/website/web-pre.sh (about) 1 #!/usr/bin/env bash 2 3 if ! [[ "$0" =~ "tools/website/web-pre.sh" ]]; then 4 echo "must be run from repository root" 5 exit 255 6 fi 7 8 WEBSITE_DIR="website" 9 ORIGINAL_CONTENT_DIR="docs" 10 OUTPUT_CONTENT_DIR="${WEBSITE_DIR}/content/en/docs" 11 12 rm -rf ${OUTPUT_CONTENT_DIR} || true 13 mkdir -p ${OUTPUT_CONTENT_DIR} 14 15 # Copy original content. 16 cp -r ${ORIGINAL_CONTENT_DIR}/* ${OUTPUT_CONTENT_DIR} 17 cp -r code-of-conduct.md CHANGELOG.md ${OUTPUT_CONTENT_DIR} 18 cp GOVERNANCE.md ${OUTPUT_CONTENT_DIR}/contributing/governance.md 19 cp images/* ${WEBSITE_DIR}/static/images 20 21 # Add headers to special CODE_OF_CONDUCT.md and CHANGELOG.md files. 22 echo "$(cat <<EOT 23 --- 24 title: Code of Conduct 25 type: docs 26 originalpath: code-of-conduct.md 27 weight: 13 28 --- 29 EOT 30 )" > ${OUTPUT_CONTENT_DIR}/code-of-conduct.md 31 tail -n +2 code-of-conduct.md >> ${OUTPUT_CONTENT_DIR}/code-of-conduct.md 32 33 echo "$(cat <<EOT 34 --- 35 title: Changelog 36 type: docs 37 originalpath: CHANGELOG.md 38 weight: 12 39 --- 40 EOT 41 )" > ${OUTPUT_CONTENT_DIR}/CHANGELOG.md 42 tail -n +2 CHANGELOG.md >> ${OUTPUT_CONTENT_DIR}/CHANGELOG.md 43 44 echo "$(cat <<EOT 45 --- 46 title: Governance 47 type: docs 48 originalpath: GOVERNANCE.md 49 weight: 1 50 --- 51 EOT 52 )" > ${OUTPUT_CONTENT_DIR}/contributing/governance.md 53 tail -n +2 GOVERNANCE.md >> ${OUTPUT_CONTENT_DIR}/contributing/governance.md 54 55 ALL_DOC_CONTENT_FILES=`echo "${OUTPUT_CONTENT_DIR}/**/*.md ${OUTPUT_CONTENT_DIR}/*.md"` 56 for file in $(find ${OUTPUT_CONTENT_DIR} -name '*.md') 57 do 58 go run ./tools/website/website.go $file 59 done