diff --git a/.gitignore b/.gitignore index 15e1931..3403d77 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ +.hugo_build.lock +.idea/ public/ resources/ themes/*_dev -.idea/ diff --git a/auto_build.sh b/auto_build.sh index f7e2958..5a6b05b 100755 --- a/auto_build.sh +++ b/auto_build.sh @@ -1,5 +1,6 @@ #!/usr/bin/env sh +#set -x # Display the value of PS4, followed by the command and its arguments. set -e # Exit immediately if a command exits with a non-zero status. set -u # Treat unset variables as an error when substituting. @@ -28,12 +29,15 @@ purge_local () { # clone repo if not already there clone_local () { if [ ! -d "$CLONE_DIR" ]; then - git clone \ + if ! git clone \ --quiet \ --branch "$BRANCH" \ --recurse-submodules \ "${GIT_BASE}/${OWNER}/${REPO}.git" \ "$CLONE_DIR" + then + exit 1 + fi fi } @@ -69,11 +73,14 @@ latest_local_sha () { # get latest commit id of server latest_remote_sha () { - curl -sq \ + if ! curl --silent --fail --show-error \ -X GET \ -H "accept: application/json" \ "${GIT_BASE}/api/v1/repos/${OWNER}/${REPO}/commits?sha=${BRANCH}&limit=1" \ | jq -M -r '.[0].sha' + then + exit 1 + fi }