chore: cleanup travis scripts (#766)
* chore: cleanup travis scripts * remove unused script
This commit is contained in:
parent
b73dd548ae
commit
8eb30d02e9
8
bin/backup-mastodon-data.sh
Executable file
8
bin/backup-mastodon-data.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -x
|
||||||
|
set -e
|
||||||
|
|
||||||
|
PGPASSWORD=pinafore pg_dump -U pinafore -w pinafore_development > fixtures/dump.sql
|
||||||
|
cd mastodon/public/system
|
||||||
|
tar -czf ../../../fixtures/system.tgz .
|
8
bin/deploy-all-travis.sh
Executable file
8
bin/deploy-all-travis.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
if [ "$TRAVIS_BRANCH" = master -a "$TRAVIS_PULL_REQUEST" = false ]; then
|
||||||
|
npm run deploy-dev
|
||||||
|
fi
|
38
bin/deploy.sh
Executable file
38
bin/deploy.sh
Executable file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
PATH="$PATH:./node_modules/.bin"
|
||||||
|
|
||||||
|
# set up robots.txt
|
||||||
|
if [[ "$DEPLOY_TYPE" == "prod" ]]; 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
|
||||||
|
|
||||||
|
#launch
|
||||||
|
$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
|
||||||
|
$NOW_COMMAND alias "$NOW_ALIAS"
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
$NOW_COMMAND rm pinafore --safe --yes
|
20
package.json
20
package.json
|
@ -33,22 +33,10 @@
|
||||||
"wait-for-mastodon-data": "node -r esm bin/wait-for-mastodon-data.js",
|
"wait-for-mastodon-data": "node -r esm bin/wait-for-mastodon-data.js",
|
||||||
"globalize-css": "node ./bin/globalize-css.js",
|
"globalize-css": "node ./bin/globalize-css.js",
|
||||||
"deglobalize-css": "node ./bin/globalize-css.js --reverse",
|
"deglobalize-css": "node ./bin/globalize-css.js --reverse",
|
||||||
"stage-dev": "printf 'User-agent: *\nDisallow: /' > assets/robots.txt",
|
"deploy-prod": "DEPLOY_TYPE=prod ./bin/deploy.sh",
|
||||||
"stage-prod": "rm -f assets/robots.txt",
|
"deploy-dev": "DEPLOY_TYPE=dev ./bin/deploy.sh",
|
||||||
"launch": "now -e SAPPER_TIMESTAMP=$(date +%s%3N) --team nolanlawson && sleep 60",
|
"deploy-all-travis": "./bin/deploy-all-travis.sh",
|
||||||
"launch-travis": "now -e SAPPER_TIMESTAMP=$(date +%s%3N) --team nolanlawson --token $NOW_TOKEN && sleep 60",
|
"backup-mastodon-data": "./bin/backup-mastodon-data.sh"
|
||||||
"alias-prod": "now alias pinafore.social --team nolanlawson",
|
|
||||||
"alias-prod-travis": "now alias pinafore.social --team nolanlawson --token $NOW_TOKEN",
|
|
||||||
"alias-dev": "now alias dev.pinafore.social --team nolanlawson",
|
|
||||||
"alias-dev-travis": "now alias dev.pinafore.social --team nolanlawson --token $NOW_TOKEN",
|
|
||||||
"cleanup": "now rm pinafore --safe --yes --team nolanlawson",
|
|
||||||
"cleanup-travis": "now rm pinafore --safe --yes --team nolanlawson --token $NOW_TOKEN",
|
|
||||||
"deploy-prod": "run-s stage-prod launch alias-prod cleanup",
|
|
||||||
"deploy-dev": "run-s stage-dev launch alias-dev cleanup",
|
|
||||||
"deploy-dev-travis": "run-s stage-dev launch-travis alias-dev-travis cleanup-travis; fi",
|
|
||||||
"deploy-prod-travis": "if echo $TRAVIS_COMMIT_MESSAGE | grep -q -E '\\d+\\.\\d+\\.\\d+'; then run-s stage-prod launch-travis alias-prod-travis cleanup-travis; fi",
|
|
||||||
"deploy-all-travis": "if [ $TRAVIS_BRANCH = master -a $TRAVIS_PULL_REQUEST = false ]; then run-s deploy-dev-travis deploy-prod-travis; fi",
|
|
||||||
"backup-mastodon-data": "PGPASSWORD=pinafore pg_dump -U pinafore -w pinafore_development > fixtures/dump.sql && cd mastodon/public/system && tar -czf ../../../fixtures/system.tgz ."
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@gamestdio/websocket": "^0.2.8",
|
"@gamestdio/websocket": "^0.2.8",
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
const isLocalhost = !process.browser ||
|
|
||||||
location.hostname === 'localhost' ||
|
|
||||||
location.hostname === '127.0.0.1'
|
|
||||||
|
|
||||||
function targetIsLocalhost (instanceName) {
|
function targetIsLocalhost (instanceName) {
|
||||||
return instanceName.startsWith('localhost:') || instanceName.startsWith('127.0.0.1:')
|
return instanceName.startsWith('localhost:') || instanceName.startsWith('127.0.0.1:')
|
||||||
}
|
}
|
||||||
|
|
||||||
export function basename (instanceName) {
|
export function basename (instanceName) {
|
||||||
if (isLocalhost && targetIsLocalhost(instanceName)) {
|
if (targetIsLocalhost(instanceName)) {
|
||||||
return `http://${instanceName}`
|
return `http://${instanceName}`
|
||||||
}
|
}
|
||||||
return `https://${instanceName}`
|
return `https://${instanceName}`
|
||||||
|
|
Loading…
Reference in a new issue