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 - name: Test Site
run: | 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 - name: Deploy
run: | run: |
bash tools/deploy.sh bash tools/deploy.sh

View file

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