2018-12-09 02:15:01 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
PATH="$PATH:./node_modules/.bin"
|
|
|
|
|
2019-03-31 19:55:54 +02:00
|
|
|
# need to build to update now.json
|
|
|
|
yarn run build
|
|
|
|
|
2018-12-09 02:15:01 +01:00
|
|
|
# set up robots.txt
|
2018-12-09 03:07:50 +01:00
|
|
|
if [[ "$DEPLOY_TYPE" == "dev" ]]; then
|
2018-12-11 16:31:48 +01:00
|
|
|
printf 'User-agent: *\nDisallow: /' > static/robots.txt
|
2018-12-09 02:15:01 +01:00
|
|
|
else
|
2018-12-11 16:31:48 +01:00
|
|
|
rm -f static/robots.txt
|
2018-12-09 02:15:01 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# if in travis, use the $NOW_TOKEN
|
2019-03-22 23:55:22 +01:00
|
|
|
NOW_COMMAND="now --scope nolanlawson"
|
2018-12-09 02:15:01 +01:00
|
|
|
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))
|
2018-12-09 02:15:01 +01:00
|
|
|
|
|
|
|
# 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 19:39:20 +01:00
|
|
|
$NOW_COMMAND alias "$URL" "$NOW_ALIAS"
|
2018-12-09 02:15:01 +01:00
|
|
|
|
|
|
|
# cleanup
|
|
|
|
$NOW_COMMAND rm pinafore --safe --yes
|