From b3d67596736cd52a8eb5b2e181f03d0c3038255a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Fri, 9 Jun 2023 01:17:07 +0100 Subject: [PATCH] ci: main branch should be considered as prod deployment --- scripts/deploy.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index bb67ce9..7f4b2b4 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -3,11 +3,15 @@ BRANCH_NAME="$(git branch --show-current)" __netlify_upload() { + local production="$DEPLOY_PRODUCTION" + [[ -z "$production" ]] && production="false" + [[ "$BRANCH_NAME" = "main" ]] && production="true" + curl -sL \ -H "Content-Type: application/zip" \ -H "Authorization: Bearer ${NETLIFY_API_KEY}" \ --data-binary "@${1}" \ - "https://api.netlify.com/api/v1/sites/${NETLIFY_SITE_ID}/deploys?branch=${BRANCH_NAME}" + "https://api.netlify.com/api/v1/sites/${NETLIFY_SITE_ID}/deploys?branch=${BRANCH_NAME}&production=${production}" } __netlify_get_deploy() {