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,8 +67,12 @@ 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: |
bash tools/deploy.sh

View file

@ -22,8 +22,9 @@ help() {
echo " bash ./tools/test.sh [options]"
echo
echo "Options:"
echo " --build Run jekyll build before testing."
echo " -h, --help Print this information."
echo " --build Run Jekyll build before test."
echo " -d, --dir <path> Specify the test path."
echo " -h, --help Print this information."
}
if [[ -n $1 && -d $1 ]]; then
@ -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