Pinafore-Web-Client-Frontend/bin/deploy.sh

39 lines
736 B
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
set -x
PATH="$PATH:./node_modules/.bin"
# set up robots.txt
2018-12-09 03:07:50 +01:00
if [[ "$DEPLOY_TYPE" == "dev" ]]; then
printf 'User-agent: *\nDisallow: /' > assets/robots.txt
else
rm -f assets/robots.txt
fi
# if in travis, use the $NOW_TOKEN
NOW_COMMAND="now --team nolanlawson"
if [[ ! -z "$NOW_TOKEN" ]]; then
NOW_COMMAND="$NOW_COMMAND --token $NOW_TOKEN"
fi
2018-12-09 03:07:50 +01:00
# launch
URL=$($NOW_COMMAND -e SAPPER_TIMESTAMP=$(date +%s%3N))
# fixes issues with now being unavailable immediately
sleep 60
# choose the right alias
NOW_ALIAS="dev.pinafore.social"
if [[ "$DEPLOY_TYPE" == "prod" ]]; then
NOW_ALIAS="pinafore.social"
fi
# alias
2018-12-09 03:07:50 +01:00
$NOW_COMMAND alias "$NOW_ALIAS" "$URL"
# cleanup
$NOW_COMMAND rm pinafore --safe --yes