From 3b446a605de4c31f967e75593fe8ebb2df7deec1 Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Sun, 27 Mar 2022 23:02:37 +0200 Subject: [PATCH] Add error handling for netlify deployment Signed-off-by: Tilman Vatteroth --- netlify/deploy-main.sh | 6 ++++++ netlify/deploy-pr.sh | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/netlify/deploy-main.sh b/netlify/deploy-main.sh index 1cbc3b697..a48466c7d 100644 --- a/netlify/deploy-main.sh +++ b/netlify/deploy-main.sh @@ -6,6 +6,12 @@ json=$(yarn netlify deploy --build --prod --json --message "${1:0:8}: $2") +if [ $? -ne 0 ]; then + echo "Error while executing netlify! Will try again without json..." + yarn netlify deploy --build --prod --message "${1:0:8}: $2" + exit 1 +fi + echo "${json}" url=$(echo "${json}" | jq -r .deploy_url) diff --git a/netlify/deploy-pr.sh b/netlify/deploy-pr.sh index fe884b9cf..f71ed67a0 100755 --- a/netlify/deploy-pr.sh +++ b/netlify/deploy-pr.sh @@ -6,6 +6,12 @@ json=$(yarn netlify deploy --build --context deploy-preview --alias "$1" --json --message "[#$1] $2") +if [ $? -ne 0 ]; then + echo "Error while executing netlify! Will try again without json..." + yarn netlify deploy --build --context deploy-preview --alias "$1" --message "[#$1] $2" + exit 1 +fi + echo "${json}" url=$(echo "${json}" | jq -r .deploy_url)