Skip to content

Commit

Permalink
docs(v2): add instructions on Travis CI deployment (#2289)
Browse files Browse the repository at this point in the history
* docs: update versioned_docs/deployment with travis-ci

* docs: update docs/deployment with travis-ci

* Transfer update to a new version

* Update node version

* update v-2.0.0-alpha.43 with Travis CI deployment instructions

* Remove updates from v2.0.0-alpha.43

* Update deployment.md

Co-authored-by: Yangshun Tay <tay.yang.shun@gmail.com>
  • Loading branch information
mohamedsgap and yangshun authored Feb 19, 2020
1 parent 996b115 commit e656285
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions website/docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,32 @@ Render offers [free static site hosting](https://render.com/docs/static-sites) w
| **Publish Directory** | `build` |

That's it! Your app will be live on your Render URL as soon as the build finishes.

### Deplying to Travis CI

Continuous integration (CI) services are typically used to perform routine tasks whenever new commits are checked in to source control. These tasks can be any combination of running unit tests and integration tests, automating builds, publishing packages to NPM, and deploying changes to your website. All you need to do to automate deployment of your website is to invoke the `yarn deploy` script whenever your website is updated. The following section covers how to do just that using [Travis CI](https://travis-ci.com/), a popular continuous integration service provider.

1. Go to https://github.com/settings/tokens and generate a new [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/)
1. Using your GitHub account, [add the Travis CI app](https://github.com/marketplace/travis-ci) to the repository you want to activate.
1. Open your Travis CI dashboard. The URL looks like https://travis-ci.com/USERNAME/REPO, and navigate to the `More options` > `Setting` > `Environment Variables` section of your repository.
1. Create a new environment variable named `GH_TOKEN` with your newly generated token as its value, then `GH_EMAIL` (your email address) and `GH_NAME` (your GitHub username).
1. Create a `.travis.yml` on the root of your repository with the following:

```yaml
# .travis.yml
language: node_js
node_js:
- '10'
branches:
only:
- master
cache:
yarn: true
script:
- git config --global user.name "${GH_NAME}"
- git config --global user.email "${GH_EMAIL}"
- echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc
- yarn && GIT_USER="${GH_NAME}" yarn deploy
```
Now, whenever a new commit lands in `master`, Travis CI will run your suite of tests and if everything passes, your website will be deployed via the `yarn deploy` script.

0 comments on commit e656285

Please sign in to comment.