diff --git a/.github/workflows/pages-deploy.yml.hook b/.github/workflows/pages-deploy.yml.hook index 322f5e0..dbbe3a0 100644 --- a/.github/workflows/pages-deploy.yml.hook +++ b/.github/workflows/pages-deploy.yml.hook @@ -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 diff --git a/tools/test.sh b/tools/test.sh index 0eda427..6ff57f0 100755 --- a/tools/test.sh +++ b/tools/test.sh @@ -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 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