From e96ebeac80123ed1d8bb50f39554aecd93f9cc28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Sat, 10 Jun 2023 17:08:48 +0100 Subject: [PATCH] ci: deploy to main site when branch is main --- scripts/deploy.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 7f4b2b4..ddcc6c5 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -3,15 +3,19 @@ BRANCH_NAME="$(git branch --show-current)" __netlify_upload() { + local branch="$BRANCH_NAME" local production="$DEPLOY_PRODUCTION" [[ -z "$production" ]] && production="false" - [[ "$BRANCH_NAME" = "main" ]] && production="true" + if [[ "$BRANCH_NAME" = "main" ]]; then + production="true" + branch="" + fi 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}&production=${production}" + "https://api.netlify.com/api/v1/sites/${NETLIFY_SITE_ID}/deploys?branch=${branch}&production=${production}" } __netlify_get_deploy() {