Hello
I am writing GitHub actions to deploy a site on Netlify. Without domain aliases, it worked well, but it’s not working with domain aliases.
I would love to get help to know what went wrong with below script.
- name: Ensure Redirect Site Exists
run: |
SITE_NAME="joltz-staging-${BRANCH_NAME}-redirect"
CUSTOM_DOMAIN="consumer.${BRANCH_NAME}.joltz.dev"
DOMAIN_ALIASES="[\"netlify-fly.joltz.dev\"]"
SITE_INFO=$(netlify api listSitesForAccount --data '{ "account_slug": "joltz" }' --json | jq -r '.[] | select(.name=="'${SITE_NAME}'")')
if [ -z "$SITE_INFO" ]; then
SITE_INFO=$(netlify api createSiteInTeam --data '{ "account_slug": "joltz", "body": { "name": "'"${SITE_NAME}"'", "custom_domain": "'"${CUSTOM_DOMAIN}"'", "domain_aliases": '"${DOMAIN_ALIASES}"' } }')
fi
SITE_ID=$(echo $SITE_INFO | jq -r '.id')
echo "SITE_ID_REDIRECT=${SITE_ID}" >> $GITHUB_ENV
Thanks!