touch .travis.yml
- Copy paste the following
language: node_js
node_js: stable
cache:
directories:
- node_modules
before_deploy:
- "npm run build"
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
local_dir: dist
on:
branch: master
- On github go here: https://github.com/settings/tokens
- Generate new token with all repo access (first checkbox)
- token name: (i.e. the repo name)
- Copy the token (string in the green background)
- Add your repository
- in https://travis-ci.org/{user}/{reponame}, go to more option menu, then settings.
- add new environment variable - Display value in build log must be switch off!
Now on every push to master (merge, PR...), travis will launch the command npm run build
(feel free to change it!). It will put the build under the dist
folder (see local_dir
value in yml file).
Then this folder is pushed to a branch called gh-pages
(stand for github pages).
Go to the repo settings you will see something related to gh-pages.
The app should be available under this URI: {user}.github.io/{repo-name}/ or www.your-domain/{repo} if you setup a CNAME.
Updated: add
edge: true
to deploy config