mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-09-10 17:53:50 +02:00
build-pdf: only build changed folders since last commit
This commit is contained in:
parent
ad11098280
commit
f907fcbb2f
1 changed files with 18 additions and 4 deletions
22
scripts/pdf/build-pdf.sh
Normal file → Executable file
22
scripts/pdf/build-pdf.sh
Normal file → Executable file
|
@ -21,13 +21,27 @@ function process_page {
|
||||||
}
|
}
|
||||||
|
|
||||||
function main {
|
function main {
|
||||||
for pageDir in ../../pages*; do
|
type="$1"
|
||||||
process_page "${pageDir}"
|
case $type in
|
||||||
done
|
"all")
|
||||||
|
for pageDir in ../../pages*; do
|
||||||
|
process_page "${pageDir}"
|
||||||
|
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue