Commit c2e72cd7 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Adding some validation for the generated mkdocs.yml file

parent 8fc14dfa
Loading
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -94,7 +94,13 @@ sed -i 's/##REPO_NAME/'${CI_PROJECT_NAME^^}'/g' mkdocs.yml

sed --version

echo "------ Content of mkdocs.yml before adding download and release notes tabs--------"
cat mkdocs.yml
echo "------ Validate mkdocs.yml before adding download and release notes tabs--------"
python3 -c "from mkdocs.config import load_config; load_config('mkdocs.yml')" || {
    echo "mkdocs.yml failed validation; see output above."
    exit 1
}
## Create download tab if official baseline version
if [[ ${TAG_NAME} == v* ]]; then
    echo "\nAdding download tab for version ${TAG_NAME}..."
@@ -131,6 +137,15 @@ if [[ ${TAG_NAME} == v* ]]; then
    echo "  - Release Notes: 'release_notes/index.md'" >> mkdocs.yml
fi


echo "------ Content of mkdocs.yml after adding download and release notes tabs--------"
cat mkdocs.yml
echo "------ Validate mkdocs.yml after adding download and release notes tabs--------"
python3 -c "from mkdocs.config import load_config; load_config('mkdocs.yml')" || {
    echo "mkdocs.yml failed validation; see output above."
    exit 1
}

if [ ${CLEAN_WEB_PAGES} == "false" ]; then
    echo "------ Generating site --------"
    echo "Generating docs version ${TAG_NAME}..."
@@ -262,10 +277,19 @@ else
    mike delete --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH ${CLEAN_WEB_PAGES}
fi

git checkout $PAGES_BRANCH -- public/
git checkout "${PAGES_BRANCH}" -- public/
#if git show-ref --verify --quiet "refs/heads/${PAGES_BRANCH}" \
#    || git show-ref --verify --quiet "refs/remotes/origin/${PAGES_BRANCH}"; then
#    git fetch origin "${PAGES_BRANCH}" 2>/dev/null || true
#    git checkout "${PAGES_BRANCH}" -- public/ 2>/dev/null \
#        || echo "public/ not present on ${PAGES_BRANCH} yet."
#else
#    echo "No ${PAGES_BRANCH} branch yet; skipping public/ checkout."
#fi

echo "Content of public ..."
ls public/
#ls public/ 2>/dev/null || echo "public/ not available"

exit 0