Skip to content

Commit

Permalink
Merge pull request #83 from onfido/bug/surge-certificate-issue
Browse files Browse the repository at this point in the history
fixed surge https certiticate issue
  • Loading branch information
rfreitas authored Oct 25, 2016
2 parents 21f349f + 335ecad commit d4b5784
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DEPLOY_SUBDOMAIN_UNFORMATTED_LIST=()

if [ "$TRAVIS_PULL_REQUEST" != "false" ]
then
DEPLOY_SUBDOMAIN_UNFORMATTED_LIST+=(${TRAVIS_PULL_REQUEST}.pr)
DEPLOY_SUBDOMAIN_UNFORMATTED_LIST+=(${TRAVIS_PULL_REQUEST}-pr)
elif [ -n "${TRAVIS_TAG// }" ] #TAG is not empty
then
LATEST_TAG=`git tag | sort -r | sed -n 1p`
Expand All @@ -22,24 +22,24 @@ then
DEPLOY_SUBDOMAIN_UNFORMATTED_LIST+=(latest)
fi

DEPLOY_SUBDOMAIN_UNFORMATTED_LIST+=(${TRAVIS_TAG}.tag)
DEPLOY_SUBDOMAIN_UNFORMATTED_LIST+=(${TRAVIS_TAG}-tag)
else
DEPLOY_SUBDOMAIN_UNFORMATTED_LIST+=(${TRAVIS_BRANCH}.branch)
DEPLOY_SUBDOMAIN_UNFORMATTED_LIST+=(${TRAVIS_BRANCH}-branch)
fi


for DEPLOY_SUBDOMAIN_UNFORMATTED in "${DEPLOY_SUBDOMAIN_UNFORMATTED_LIST[@]}"
do
echo $DEPLOY_SUBDOMAIN_UNFORMATTED

# replaces "/" with "."
# replaces "/" or "." with "-"
# sed -r is only supported in linux, ref http://stackoverflow.com/a/2871217/689223
# Domain names follow the RFC1123 spec [a-Z] [0-9] [-]
# The length is limited to 253 characters
# https://en.wikipedia.org/wiki/Domain_Name_System#Domain_name_syntax
DEPLOY_SUBDOMAIN=`echo "$DEPLOY_SUBDOMAIN_UNFORMATTED" | sed -r 's/[\/]+/\./g'`
DEPLOY_SUBDOMAIN=`echo "$DEPLOY_SUBDOMAIN_UNFORMATTED" | sed -r 's/[\/|\.]+/\-/g'`

DEPLOY_DOMAIN=https://${DEPLOY_SUBDOMAIN}.${REPO_NAME}.${REPO_OWNER}.surge.sh
DEPLOY_DOMAIN=https://${DEPLOY_SUBDOMAIN}-${REPO_NAME}-${REPO_OWNER}.surge.sh

surge --project ${DEPLOY_PATH} --domain $DEPLOY_DOMAIN;

Expand Down

0 comments on commit d4b5784

Please sign in to comment.