This demo was created to demonstrate a sample workflow for continuous integration and automated deployment from Travis-CI to GitHub Pages.
- Open the GitHub Pages url
- Create a new branch
- Remove the text from one of the entries in content.json
- Commit changes with a descriptive message
- Create a pull request with a descriptive message
- Wait for Travis-CI to complete (there should be an error)
- Go back to the content.json file and add text to the blank entry
- Commit changes with a descriptive message
- Go back to the open pull request and wait for Travis to complete (it should be green)
- Optional - Refresh/goto the GitHub Pages url to confirm no changes were made
- Merge the pull request
- Refresh/goto the GitHub Pages and confirm the changes are reflected
After a successful deployment, you can view the results on GitHub Pages for this repository.
The tests are written in mocha and check for blank entries in the content.json.
All steps happen on the Travis-CI container and can be monitored by going to the Travis dashboard.
- Sets global variables
- Updates git config
- Builds packages with
npm install
- Clones GitHub Pages branch
gh-pages
intodist
folder - Cleans and rebuilds
dist
folder by runningnpm run build
- Runs tests by calling
npm test
- Commits changes
- If request is not a pull request and is the master branch, Travis will push the
dist
folder togh-pages
in GitHub.
All Travis-CI settings are stored in the .travis.yml file. There are four environment variables that you may want to adjust if you decide to fork this repo.
Variable | Description |
---|---|
GIT_NAME | The display name to use when Travis commits to Git |
GIT_EMAIL | The email address to use when Travis commits to Git |
GIT_DOMAIN | The domain address of the GitHub or GitHub Enterprise server |
GH_TOKEN | The encrypted GitHub personal access token used to deploy |
The local server runs on Webpack Dev Server.
Setup
$ npm install
Tests
$ npm test
Build
$ npm run build
WebServer
$ npm start
URLs
- Main Site - http://localhost:8080
- Development - http://localhost:8080/webpack-dev-server