build-pdf: only build changed folders since last commit
This commit is contained in:

committed by
K.B.Dharun Krishna

parent
ad11098280
commit
f907fcbb2f
16
scripts/pdf/build-pdf.sh
Normal file → Executable file
16
scripts/pdf/build-pdf.sh
Normal file → Executable file
@@ -21,13 +21,27 @@ function process_page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function main {
|
function main {
|
||||||
|
type="$1"
|
||||||
|
case $type in
|
||||||
|
"all")
|
||||||
for pageDir in ../../pages*; do
|
for pageDir in ../../pages*; do
|
||||||
process_page "${pageDir}"
|
process_page "${pageDir}"
|
||||||
done
|
done
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
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)
|
||||||
|
mapfile -t pageDirs <<< "$changedPageDirs"
|
||||||
|
|
||||||
|
for pageDir in "${pageDirs[@]}"; do
|
||||||
|
process_page "../../${pageDir}"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
# MAIN
|
# MAIN
|
||||||
###################################
|
###################################
|
||||||
|
|
||||||
main
|
main $1
|
||||||
|
Reference in New Issue
Block a user