fix(script): secret handle

pull/1/head v0.1.2
Luca Perret 2018-02-15 22:11:09 +01:00
parent 4e780c7beb
commit b40ed139b5
1 changed files with 12 additions and 0 deletions

View File

@ -18,6 +18,17 @@ else
NETLIFY_DEPLOY_OPTIONS="${NETLIFY_DEPLOY_OPTIONS} -p ./" NETLIFY_DEPLOY_OPTIONS="${NETLIFY_DEPLOY_OPTIONS} -p ./"
fi fi
if [ -z "$PLUGIN_TOKEN" ]
then
if [ -z "$NETLIFY_TOKEN" ]
then
echo "> Error! token or netlify_token secret is required"
exit 1;
else
PLUGIN_TOKEN="$NETLIFY_TOKEN"
fi
fi
if [ -n "$PLUGIN_SITE_ID" ] && [ -n "$PLUGIN_TOKEN" ] if [ -n "$PLUGIN_SITE_ID" ] && [ -n "$PLUGIN_TOKEN" ]
then then
NETLIFY_SITE="-t $PLUGIN_TOKEN -s $PLUGIN_SITE_ID" NETLIFY_SITE="-t $PLUGIN_TOKEN -s $PLUGIN_SITE_ID"
@ -25,6 +36,7 @@ then
netlify $NETLIFY_SITE deploy $NETLIFY_DEPLOY_OPTIONS; netlify $NETLIFY_SITE deploy $NETLIFY_DEPLOY_OPTIONS;
else else
echo "> Error! site_id and token are required" echo "> Error! site_id and token are required"
exit 1
fi fi
if [ -n "$PLUGIN_SITE_NAME" ] if [ -n "$PLUGIN_SITE_NAME" ]