Last active
July 25, 2018 02:19
-
-
Save pwmckenna/4644722 to your computer and use it in GitHub Desktop.
template for a .travis.yml file that tells travis to build your master branch using `yeoman build` and deploy the output to your project's gh-pages branch.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This .travis.yml file instructs travis-ci.org to build your master branch using `yeoman build` | |
# and deploy the output to your project's gh-pages branch. | |
# | |
# You must sign into travis-ci.org and set the commit hook on your project for travis to | |
# run on your project. You also need to replace the env variables below. The secure: variable | |
# must be generated by running `travis encrypt` on a github oauth key that you can generate using | |
# curl. | |
language: | |
node_js | |
node_js: | |
- 0.8 | |
branches: | |
only: | |
- master | |
env: | |
global: | |
# GH_OAUTH_TOKEN is the oauth token generated as described at | |
# https://help.github.com/articles/creating-an-oauth-token-for-command-line-use | |
# | |
# curl -u 'username' -d '{"scopes":["repo"],"note":"push to gh-pages from travis"}' https://api.github.com/authorizations | |
# | |
# It must be encrypted using the travis gem | |
# http://about.travis-ci.org/docs/user/build-configuration/#Secure-environment-variables | |
# | |
# travis encrypt GH_OAUTH_TOKEN=b2797fff05e7461c4c8174fae08fb006cbadba9f | |
# | |
- secure: "fPayt+89Ymzwvxxn2Srf9FCuhfJnC/GygYeHEYIVYOABSC496LLtJwJ/QrxW\n4WqpHhGuBgKAEjcyJBp2nz5EcACGeqqbsg1OAwD4N7r3A0za7HgEDng+Pdz7\nVYPTOS1VZg/+9vIyJoDyZe5tMyteSDGnBvex41RENar01R83anw=" | |
# User specific env variables | |
- GH_USER_NAME: pwmckenna | |
- GH_PROJECT_NAME: todium | |
- GH_FULL_NAME: Patrick Williams | |
- GH_EMAIL: [email protected] | |
before_script: | |
# install dependencies | |
- gem install compass | |
- gem install jpegtran | |
- gem install optipng | |
- npm install yeoman -g | |
script: | |
# We want to gate on passing tests and a successful build | |
- yeoman install --disable-insight | |
- yeoman test --disable-insight | |
- yeoman build --disable-insight | |
after_script: | |
- git config --global user.email "${GH_EMAIL}" | |
- git config --global user.name "${GH_FULL_NAME}" | |
# Any command that using GH_OAUTH_TOKEN must pipe the output to /dev/null to not expose your oauth token | |
- git submodule add -b gh-pages https://${GH_OAUTH_TOKEN}@github.com/${GH_USER_NAME}/${GH_PROJECT_NAME} site 2>&1 | |
- cd site | |
- git checkout gh-pages | |
- git rm -r . | |
- cp -R ../dist/* . | |
- cp ../dist/.* . | |
- git add -f . | |
- git commit -am "adding the yeoman build files to gh-pages" | |
# Any command that using GH_OAUTH_TOKEN must pipe the output to /dev/null to not expose your oauth token | |
- git push https://${GH_OAUTH_TOKEN}@github.com/${GH_USER_NAME}/${GH_PROJECT_NAME} gh-pages > /dev/null 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment