summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscript/deploy27
1 files changed, 19 insertions, 8 deletions
diff --git a/script/deploy b/script/deploy
index 3db6cb1..f290b75 100755
--- a/script/deploy
+++ b/script/deploy
@@ -10,6 +10,15 @@
set -o errexit
set -o nounset
+ask_proceed() {
+ printf 'Proceed? (y/N): '
+ read -r REPLY
+ case "$REPLY" in
+ y|yes|Y|YES) return 0 ;;
+ *) return 1 ;;
+ esac
+}
+
# Git root directory
root="$( git rev-parse --show-toplevel )"
@@ -25,18 +34,20 @@ now="$( date -u "+%Y-%m-%dT%H:%M:%SZ" )"
# Archive file name
archive="./${now}-${rev}.tar.gz"
-printf "Re-generating static website from source ...\\n"
+echo "Re-generating static website from source ..."
( cd "${root}" \
&& cabal v2-run exe:site -- clean >/dev/null 2>&1 \
&& cabal v2-run exe:site -- build >/dev/null 2>&1 )
-printf "Running checks ...\\n"
-( cd "${root}" && ./script/check )
+echo "Running checks ..."
+( cd "${root}" && ./script/check ) || {
+ ( >&2 echo "error: check failed" )
+ ask_proceed
+}
[ -z "$( git status --porcelain )" ] || {
- ( >&2 printf "error: dirty working tree\\n" )
- printf "Aborting deployment due to unstaged changes or untracked files.\\n"
- exit 1
+ ( >&2 echo "error: dirty working tree" )
+ ask_proceed
}
openrsync --rsync-path=openrsync --archive --delete --verbose \
@@ -50,10 +61,10 @@ curl \
--silent \
--output /dev/null \
http://www.google.com/ping?sitemap=https://www.skreutz.com/sitemap.xml \
- || ( >&2 printf "error: failed to submit live sitemap to google.com\\n" )
+ || ( >&2 echo "error: failed to submit live sitemap to google.com" )
curl \
--silent \
--output /dev/null \
http://www.bing.com/ping?sitemap=https%3A%2F%2Fwww.skreutz.com/sitemap.xml \
- || ( >&2 printf "error: failed to submit live sitemap to bing.com\\n" )
+ || ( >&2 echo "error: failed to submit live sitemap to bing.com" )
Generated by cgit. See skreutz.com for my tech blog and contact information.