Fix the test tool and CD hook

This commit is contained in:
Cotes Chung 2020-11-20 15:59:35 +08:00
parent ea56a900a0
commit 08354cc4f5
2 changed files with 19 additions and 4 deletions

View file

@ -67,7 +67,11 @@ jobs:
- name: Test Site
run: |
bash tools/test.sh "$SPEC_TEST"
if [[ -n $SPEC_TEST ]]; then
bash tools/test.sh -d "$SPEC_TEST"
else
bash tools/test.sh
fi
- name: Deploy
run: |

View file

@ -22,7 +22,8 @@ help() {
echo " bash ./tools/test.sh [options]"
echo
echo "Options:"
echo " --build Run jekyll build before testing."
echo " --build Run Jekyll build before test."
echo " -d, --dir <path> Specify the test path."
echo " -h, --help Print this information."
}
@ -37,6 +38,16 @@ while (($#)); do
_build=true
shift
;;
-d | --dir)
if [[ ! -d $2 ]]; then
echo -e "Error: path '$2' doesn't exist\n"
help
exit 1
fi
DEST=$2
shift
shift
;;
-h | --help)
help
exit 0