Skip to content

Instantly share code, notes, and snippets.

@spiderbites
Last active August 11, 2017 13:36
Show Gist options
  • Save spiderbites/acffe9ba1b0c44d34b2375b5cd837f0d to your computer and use it in GitHub Desktop.
Save spiderbites/acffe9ba1b0c44d34b2375b5cd837f0d to your computer and use it in GitHub Desktop.
[Setting up github pages deploys from Travis] #travis #gh-pages
language: node_js
node_js:
- "6"
cache:
yarn: true # I happen to be using yarn
directories:
- node_modules
notifications:
email: false
before_deploy:
- <BUILD_COMMAND_HERE>
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
local_dir: <LOCAL_DIR_CONTAINING_STATIC_FILES>
on:
branch: master
branches:
only:
- master
  • Create a deploy user
  • Give them repository permissions
  • Create a Personal Access Token for the deploy user (Settings -> Personal Access Token) with repo permissions
  • Store that as an environmental variable in travis
  • (The motivation for creating a separate deploy user is to avoid creating a personal access token for your personal github account which would have access to all of your repos.)
  • Create a gh-pages branch on the main repository
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment