Revert "build-pdf: only build changed folders since last commit" (#11795)

Revert "build-pdf: only build changed folders since last commit (#11773)"

This reverts commit 1de7b5a80b.
pull/23/head
K.B.Dharun Krishna 2023-12-19 17:40:57 +05:30 committed by GitHub
parent 1de7b5a80b
commit 10e2c5b145
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 21 deletions

25
scripts/pdf/build-pdf.sh Executable file → Normal file
View File

@ -7,6 +7,7 @@ set -ex
function process_page {
pageDir="$1"
folder=$(basename "${pageDir}")
language="${folder##*.}"
case $folder in
pages.bn | pages.ja | pages.ko | pages.ml | pages.ta | pages.th | pages.zh | pages.zh_TW)
;;
@ -14,32 +15,14 @@ function process_page {
python3 render.py "${pageDir}" -c solarized-light
;;
*)
language="${folder##*.}"
python3 render.py "${pageDir}" -c basic -o "tldr-book-${language}.pdf"
;;
esac
}
function main {
type="$1"
case $type in
"all")
pageDirs=(../../pages*)
;;
*)
changedFiles=$(git diff-tree --no-commit-id --name-only -r "$(git rev-parse HEAD)")
changedPageDirs=$(echo "$changedFiles" | awk -F/ '/^(pages[^\/]+|pages)\//{print $1}' | sort -u)
if [ -z "$changedPageDirs" ]; then
pageDirs=()
else
mapfile -t pageDirs <<< "$changedPageDirs"
fi
;;
esac
for pageDir in "${pageDirs[@]}"; do
process_page "../../${pageDir}"
for pageDir in ../../pages*; do
process_page "${pageDir}"
done
}
@ -47,4 +30,4 @@ function main {
# MAIN
###################################
main $1
main