2018-12-09 01:15:01 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
PATH="$PATH:./node_modules/.bin"
|
|
|
|
|
2020-08-26 00:45:53 +01:00
|
|
|
# need to build to update vercel.json
|
2019-03-31 18:55:54 +01:00
|
|
|
yarn run build
|
|
|
|
|
2018-12-09 01:15:01 +00:00
|
|
|
# set up robots.txt
|
2018-12-09 02:07:50 +00:00
|
|
|
if [[ "$DEPLOY_TYPE" == "dev" ]]; then
|
2018-12-11 15:31:48 +00:00
|
|
|
printf 'User-agent: *\nDisallow: /' > static/robots.txt
|
2018-12-09 01:15:01 +00:00
|
|
|
else
|
2018-12-11 15:31:48 +00:00
|
|
|
rm -f static/robots.txt
|
2018-12-09 01:15:01 +00:00
|
|
|
fi
|
|
|
|
|
2020-11-14 23:04:28 +00:00
|
|
|
# if in travis, use the $VERCEL_TOKEN
|
2020-08-26 00:45:53 +01:00
|
|
|
DEPLOY_COMMAND="vercel --scope nolanlawson"
|
2020-11-14 23:04:28 +00:00
|
|
|
if [[ ! -z "$VERCEL_TOKEN" ]]; then
|
|
|
|
DEPLOY_COMMAND="$DEPLOY_COMMAND --token $VERCEL_TOKEN"
|
2018-12-09 01:15:01 +00:00
|
|
|
fi
|
|
|
|
|
2018-12-09 02:07:50 +00:00
|
|
|
# launch
|
2020-08-26 00:45:53 +01:00
|
|
|
URL=$($DEPLOY_COMMAND --confirm -e SAPPER_TIMESTAMP=$(date +%s%3N))
|
2018-12-09 01:15:01 +00:00
|
|
|
|
|
|
|
# fixes issues with now being unavailable immediately
|
|
|
|
sleep 60
|
|
|
|
|
|
|
|
# choose the right alias
|
2020-08-26 00:45:53 +01:00
|
|
|
DEPLOY_ALIAS="dev.pinafore.social"
|
2018-12-09 01:15:01 +00:00
|
|
|
|
|
|
|
if [[ "$DEPLOY_TYPE" == "prod" ]]; then
|
2020-08-26 00:45:53 +01:00
|
|
|
DEPLOY_ALIAS="pinafore.social"
|
2018-12-09 01:15:01 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# alias
|
2020-08-26 00:45:53 +01:00
|
|
|
$DEPLOY_COMMAND alias "$URL" "$DEPLOY_ALIAS"
|
2018-12-09 01:15:01 +00:00
|
|
|
|
|
|
|
# cleanup
|
2020-08-26 00:45:53 +01:00
|
|
|
$DEPLOY_COMMAND rm pinafore --safe --yes
|