diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index eaf0ba7c..00000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,3 +0,0 @@ -# Contributing - -See the page titled "[Ways to Contribute](https://docs.oceanprotocol.com/concepts/contributing/)" in the Ocean Protocol documentation. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..02078ab0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: 'CI' + +on: + push: + branches: + - '**' + pull_request: + branches: + - '**' + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: '14' + + - name: Cache node modules + uses: actions/cache@v1 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-node- + + - run: npm ci + - run: npm test + - run: npm run build + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 584316ed..00000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -dist: xenial -language: node_js -node_js: - - '12' - -# Deploying uses awscli and it uses Python. -# Xenial on Travis comes with Python 2 & 3 installed but 2 is default. -# Ensure pip3 is installed and upgraded. -before_install: - - sudo apt-get -qq update - - sudo apt-get install python3-pip - - sudo -H pip3 install --upgrade pip - - sudo -H pip3 install -U setuptools - -script: - # will run `npm ci` automatically here - - npm test - - 'if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then npm run build; fi' - -after_success: - - pip3 install --user awscli - - export PATH=$PATH:$HOME/.local/bin - - npm run deploy - -notifications: - email: false - -cache: - npm: true - directories: - - public diff --git a/README.md b/README.md index fa9083a4..9290721c 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,10 @@ > 🐬 Ocean Protocol documentation. https://docs.oceanprotocol.com -[![Build Status](https://travis-ci.com/oceanprotocol/docs.svg?token=3psqw6c8KMDqfdGQ2x6d&branch=master)](https://travis-ci.com/oceanprotocol/docs) +[![Build Status](https://github.com/oceanprotocol/docs/workflows/CI/badge.svg)](https://github.com/oceanprotocol/docs/actions) [![Maintainability](https://api.codeclimate.com/v1/badges/d39837421591f0bc2550/maintainability)](https://codeclimate.com/github/oceanprotocol/docs/maintainability) [![js oceanprotocol](https://img.shields.io/badge/js-oceanprotocol-7b1173.svg)](https://github.com/oceanprotocol/eslint-config-oceanprotocol) [![css bigchaindb](https://img.shields.io/badge/css-bigchaindb-39BA91.svg)](https://github.com/bigchaindb/stylelint-config-bigchaindb) -[![Greenkeeper badge](https://badges.greenkeeper.io/oceanprotocol/docs.svg?token=2757ede2de02f4679c4dfc6597a331a26f2f206fed53bfeb708c64cbe3d5f55f&ts=1541590505792)](https://greenkeeper.io/) --- @@ -22,7 +21,8 @@ - [Development](#development) - [Linting & Formatting](#linting--formatting) - [Editor Setup: VS Code](#editor-setup-vs-code) -- [Deployment](#deployment) +- [⬆️ Deployment](#️-deployment) + - [Manual Deployment](#manual-deployment) - [License](#license) ## Content @@ -41,7 +41,7 @@ The site is a React app built with [Gatsby](https://www.gatsbyjs.org), pulling i To start, clone this repo and set your `GITHUB_TOKEN` (see [GitHub GraphQL API](docs/github.md#GitHub-GraphQL-API)): ```bash -git clone --recurse-submodules git@github.com:oceanprotocol/docs.git +git clone git@github.com:oceanprotocol/docs.git cd docs/ # add GITHUB_TOKEN @@ -93,27 +93,27 @@ If you use VS Code as your editor, you can install those extensions to get linti - [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) - [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) -## Deployment +## ⬆️ Deployment -Automatic deployments are triggered upon successful tests & builds on Travis: +Every branch or Pull Request is automatically deployed by [Vercel](https://vercel.com) with their GitHub integration. A link to a deployment will appear under each Pull Request. -- push to `main` initiates a live deployment - → [docs.oceanprotocol.com](https://docs.oceanprotocol.com) -- any Pull Request, and subsequent pushes to it, initiates a beta deployment - → [betadocs.oceanprotocol.com](https://betadocs.oceanprotocol.com) +The latest deployment of the `main` branch is automatically aliased to `oceanprotocol.com`. -The deploy command simply calls the [`scripts/deploy.sh`](scripts/deploy.sh) script, syncing the contents of the `public/` folder to S3: +### Manual Deployment + +If needed, app can be deployed manually. Make sure to switch to Ocean Protocol org before deploying: ```bash -npm run deploy +# first run +vercel login +vercel switch + +# deploy +vercel +# switch alias to new deployment +vercel alias ``` -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` - ## License ```text diff --git a/package.json b/package.json index 8da24aea..e50e30a2 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,7 @@ "lint:md": "markdownlint './**/*.{md,markdown}' --ignore './{node_modules,external,public,.cache}/**/*'", "lint:yml": "prettier '**/*.{yml,yaml}' --list-different", "lint": "run-p --continue-on-error lint:js lint:md lint:yml", - "test": "npm run lint", - "deploy": "./scripts/deploy.sh" + "test": "npm run lint" }, "dependencies": { "@oceanprotocol/art": "^3.0.0", diff --git a/scripts/deploy.sh b/scripts/deploy.sh deleted file mode 100755 index 8b22d2aa..00000000 --- a/scripts/deploy.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/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="betadocs.oceanprotocol.com" -SITEMAP_URL="https%3A%2F%2Fdocs.oceanprotocol.com%2Fsitemap.xml" - -# -set -e; - -function s3sync { - aws s3 sync ./public s3://"$1" \ - --include "*" \ - --exclude "*.html" \ - --exclude "sw.js" \ - --exclude "*page-data.json" \ - --exclude "chunk-map.json" \ - --exclude "sitemap.xml" \ - --exclude ".iconstats.json" \ - --exclude "humans.txt" \ - --exclude "robots.txt" \ - --cache-control public,max-age=31536000,immutable \ - --delete \ - --acl public-read - - aws s3 sync ./public s3://"$1" \ - --exclude "*" \ - --include "*.html" \ - --include "sw.js" \ - --include "*page-data.json" \ - --include "chunk-map.json" \ - --include "sitemap.xml" \ - --include ".iconstats.json" \ - --include "humans.txt" \ - --include "robots.txt" \ - --cache-control public,max-age=0,must-revalidate \ - --delete \ - --acl public-read -} - -## -## check for pull request against main -## -if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_BRANCH" == "main" ]; then - - s3sync $AWS_S3_BUCKET_BETA - -## -## check for main push which is no pull request -## -elif [ "$TRAVIS_BRANCH" == "main" ] && [ "$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