Skip to content

Publishing to GitHub Pages

Eric Rosenbaum edited this page Jul 17, 2017 · 8 revisions

You can publish the GUI to github.io so that others on the Internet can view it.

Manually

To manually publish from a local build, first ensure your gh-pages branch is set up to track the fork you intend to publish to.

# Build for github.io
npm run build
# Commit and push the build result to your gh-pages branch
npm run deploy

This should have made and pushed a commit to the gh-pages branch, which should now be visible at https://<your username>.github.io/scratch-gui/

Automatically

You can also use Travis CI to automatically publish build results to github.io whenever you push to your fork.

Note: You will need to ensure your branch has no lint errors for the build to be published automatically

  • Generate a Personal Access Token for Travis in GitHub

    • Go to your account settings
    • image
    • Go to Personal Access Tokens under "Developer settings"
    • image
    • Click "Generate new token"
    • image
    • Give it a memorable description like "Deploy scratch-gui to Github Pages"
    • Check off public_repo permissions only
    • image
    • Generate it and copy the token
    • Important: This token represents your GitHub username AND password! Keep it secure!
  • Go to https://travis-ci.org and sign in with your Github account

  • Enable and configure your fork in Travis

    • Click on your username in the top right
    • Find your fork of scratch-gui and enable it
    • image
    • Click the gear next to the name of your fork in your account settings
      • Available at the URL https://travis-ci.org/<your username>/scratch-gui/settings
      • Also available from the dropdown "More options" -> "Settings"
      • image
    • In the Environment Variables section, add two variables
      • GH_TOKEN
        • Value: <Your personal access token generated above>
        • Leave "Display value in build log" OFF
      • RELEASE_BRANCHES
        • Value: "master develop <any other branch name you would like to build>"
        • You can turn on "Display value in build log" for debugging purposes
      • image
  • Push to one of the branches you specified in the RELEASE_BRANCHES variable

  • After Travis runs the build, it should deploy to your gh-pages

  • Visit https://<your username>.github.io/scratch-gui/ to see the build

Clone this wiki locally