mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
setup deployment
This commit is contained in:
parent
3f6aef64ff
commit
f0151e336c
@ -7,6 +7,9 @@ script:
|
||||
- npm test
|
||||
- 'if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then npm run build; fi'
|
||||
|
||||
after_success:
|
||||
- npm run deploy
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
|
20
README.md
20
README.md
@ -30,6 +30,7 @@
|
||||
- [Linting & formatting](#linting--formatting)
|
||||
- [Editor setup: VS Code](#editor-setup-vs-code)
|
||||
- [GitHub GraphQL API](#github-graphql-api)
|
||||
- [Deployment](#deployment)
|
||||
- [Authors](#authors)
|
||||
- [License](#license)
|
||||
|
||||
@ -271,6 +272,25 @@ query {
|
||||
}
|
||||
```
|
||||
|
||||
## Deployment
|
||||
|
||||
Automatic deployments are triggered upon successful tests & builds on Travis:
|
||||
|
||||
- push to `master` initiates a live deployment
|
||||
- any Pull Request, and subsequent pushes to it, initiates a beta deployment
|
||||
|
||||
The deploy command simply calls the [`scripts/deploy.sh`](scripts/deploy.sh) script, syncing the contents of the `public/` folder to S3:
|
||||
|
||||
```bash
|
||||
npm run deploy
|
||||
```
|
||||
|
||||
Requires authorization against AWS with [one of the various ways](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html), on Travis this is done with those environment variables:
|
||||
|
||||
- `AWS_ACCESS_KEY_ID`
|
||||
- `AWS_SECRET_ACCESS_KEY`
|
||||
- `AWS_DEFAULT_REGION`
|
||||
|
||||
## Authors
|
||||
|
||||
- Troy McConaghy ([@ttmc](https://github.com/ttmc)) - [Ocean Protocol](https://oceanprotocol.com)
|
||||
|
@ -18,7 +18,8 @@
|
||||
"lint:md": "markdownlint './**/*.{md,markdown}' --ignore './{node_modules,external,public}/**/*'",
|
||||
"lint:yml": "prettier '**/*.{yml,yaml}' --list-different",
|
||||
"lint": "run-p --continue-on-error lint:js lint:css lint:md lint:yml",
|
||||
"test": "npm run lint"
|
||||
"test": "npm run lint",
|
||||
"deploy": "./scripts/deploy.sh"
|
||||
},
|
||||
"dependencies": {
|
||||
"@oceanprotocol/art": "^1.0.2",
|
||||
|
52
scripts/deploy.sh
Executable file
52
scripts/deploy.sh
Executable file
@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# required environment variables:
|
||||
# AWS_ACCESS_KEY_ID
|
||||
# AWS_SECRET_ACCESS_KEY
|
||||
# AWS_DEFAULT_REGION
|
||||
AWS_S3_BUCKET="docs.oceanprotocol.com"
|
||||
AWS_S3_BUCKET_BETA="beta.docs.oceanprotocol.com"
|
||||
SITEMAP_URL="https%3A%2F%2Fdocs.oceanprotocol.com%2Fsitemap.xml"
|
||||
|
||||
#
|
||||
set -e;
|
||||
|
||||
function s3sync {
|
||||
aws s3 sync ./public s3://"$1" --exclude "*.html" --exclude "*.xml" --cache-control max-age=31536000,public,immutable --delete --acl public-read --quiet
|
||||
|
||||
aws s3 sync ./public s3://"$1" --exclude "*" --include "*.html" --include "*.xml" --cache-control max-age=0,no-cache,no-store,must-revalidate --delete --acl public-read --quiet
|
||||
}
|
||||
|
||||
##
|
||||
## check for pull request against master
|
||||
##
|
||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
|
||||
|
||||
s3sync $AWS_S3_BUCKET_BETA
|
||||
|
||||
##
|
||||
## check for master push which is no pull request
|
||||
##
|
||||
elif [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] || [ "$TRAVIS" != true ]; then
|
||||
|
||||
s3sync $AWS_S3_BUCKET
|
||||
|
||||
# ping search engines
|
||||
# returns: HTTP_STATUSCODE URL
|
||||
# curl -sL -w "%{http_code} %{url_effective}\\n" \
|
||||
# "http://www.google.com/webmasters/tools/ping?sitemap=$SITEMAP_URL" -o /dev/null \
|
||||
# "http://www.bing.com/webmaster/ping.aspx?siteMap=$SITEMAP_URL" -o /dev/null
|
||||
|
||||
echo "---------------------------------------------"
|
||||
echo " ✓ done deployment "
|
||||
echo "---------------------------------------------"
|
||||
|
||||
exit;
|
||||
|
||||
else
|
||||
|
||||
echo "---------------------------------------------"
|
||||
echo " nothing to deploy "
|
||||
echo "---------------------------------------------"
|
||||
|
||||
fi
|
Loading…
Reference in New Issue
Block a user