api-docs: return error if bundle HTML is not appended to .tmp files. (#2585)

pull/2596/head
Jason Stirnaman 2021-05-25 10:28:36 -05:00 committed by GitHub
parent d1ac50d747
commit f2dfb41a58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 0 deletions

View File

@ -66,9 +66,28 @@ weight: 304
# Create temp file with frontmatter and Redoc html
echo "$v2frontmatter" >> $version.tmp
echo "$v1frontmatter" >> $version-v1-compat.tmp
V2LEN_INIT=$(wc -c $version.tmp | awk '{print $1}')
V1LEN_INIT=$(wc -c $version-v1-compat.tmp | awk '{print $1}')
cat redoc-static.html >> $version.tmp
cat redoc-static-v1-compat.html >> $version-v1-compat.tmp
V2LEN=$(wc -c $version.tmp | awk '{print $1}')
V1LEN=$(wc -c $version-v1-compat.tmp | awk '{print $1}')
if ! [[ $V2LEN -gt $V2LEN_INIT ]]
then
echo "Error: bundle was not appended to $version.tmp"
exit $?
fi
if ! [[ $V1LEN -gt $V1LEN_INIT ]]
then
echo "Error: bundle was not appended to $version-v1-compat.tmp"
exit $?
fi
# Remove redoc file and move the tmp file to it's proper place
rm -f redoc-static.html
rm -f redoc-static-v1-compat.html