Skip to content

Commit

Permalink
UsingTravis: add Deploying GitHub Pages section
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenepeh committed Sep 20, 2017
1 parent b090f07 commit 46d34e0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions docs/UsingTravis.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,48 @@ image:travis_build.png[Travis build]
. If the build is successful, you should be able to check the coverage details of the tests at http://coveralls.io/[Coveralls]
. Update the link to the 'build status' badge at the top of the `README.adoc` to point to the build status of your own repo.

== Deploying GitHub Pages

. Ensure that you have followed the steps above to set up Travis CI.
. On GitHub, create a new user account and give this account collaborator and admin access to the repo. +
Using this account, generate a personal access token https://github.com/settings/tokens/new[here].
+
[NOTE]
Personal access tokens are like passwords so make sure you keep them secret! If the personal access token is leaked, please delete it and generate a new one.
+
[NOTE]
We use a new user account to generate the token for team projects to prevent team members from gaining access to other team members' repos. +
If you are the only one with write access to the repo, you can use your own account to generate the token.
+
--
* Add a description for the token. (e.g. `Travis CI - deploy docs to gh-pages`)
* Check the `public_repo` checkbox.
* Click `Generate Token` and copy your new personal access token.
--
We will use this token to grant Travis access to the repo.
+
image:generate_token.png[Generate token]

. Head to the https://travis-ci.org/profile[Accounts] page, and find the switch for the forked repository.
+
image:flick_repository_switch.png[Activate the switch]
+
. Click on the settings button next to the switch. In the Environment Variables section, add a new environment variable with
+
--
* name: `GITHUB_TOKEN`
* value: personal access token copied in step 1
* Display value in build log: `OFF`
--
image:travis_add_token.png[Travis add token]
+
[NOTE]
*Make sure you set `Display value in build log` to `OFF`.* +
Otherwise, other people will be able to see the personal access token and thus have access this repo. +
Similarly, make sure you *do not print `$GITHUB_TOKEN` to the logs* in Travis scripts as the logs are viewable by the public.

. Now, whenever there's a new commit to master branch, Travis will push the latest documentation to gh-pages branch.

== Repository-wide checks

In addition to running Gradle checks, we also configure Travis CI to run some repository-wide checks. Unlike the Gradle checks which only cover files used in the build process, these repository-wide checks cover _all_ files in the repository. They check for repository rules which are hard to enforce on development machines such as line ending requirements.
Expand Down
Binary file added docs/images/generate_token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/travis_add_token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 46d34e0

Please sign in to comment.