PublishGithubPages
Table of Contents
Methods
allComplete
()
When all operations are complete, this is invoked
init
()
Initialisation step for Github Pages
Used to check/ set any Github Pages environment variables
outputUrls
()
Outputs the base URL and the API URL at which the documentation should be published.
Uses CNAME file based on best guess,
otherwise defaults to *.github/*
run
()
Performs the required steps for publishing to Github pages
- runs
npm run generatedocs git fetches thegh-pagesbranch of the project into a throwaway git repository- copies the documentation generated by the
generatedocsscript into thegh-pagesbranch - copies any additional files required into the gh-pages branch
- if any files have changed,
git commitsgit pushes on thegh-pagesbranch- this is when the files actually succeed in publishing
- if necessary, cleans up the throwaway git repository
runGeneratedocs
()
Invokes the generatedocs command,
unless FLAG_SKIP_GENERATE is true,
in which case it assume that the docs
have already been generated.
runTestdocs
()
Invokes the testdocs command,
unless FLAG_SKIP_TEST is true,
in which case it is up to the client
to invoke tests as appropriate.
setUpRepo
()
Set up the git respository used to publish to github pages
setUpVars
()
Set up remaining environment variables required for publishing to github pages
Properties
GH_PUBLISH_BRANCH
String (Environment Variable)
All documentation will be published under to this branch.
For most repositories, the default gh-pages will do.
However, for user or organisation pages, master could also be appropriate
Default: 'gh-pages'
GH_REPO
String (Environment Variable)
Github repository name
Default: Second half of `REPO_SLUG`
GH_TOKEN
String (Environment Variable)
- Must be set, use an encrypted token
- If using the ruby gem:
travis encrypt GH_TOKEN=GITHUB_ACCESS_TOKEN --add - If using the npm module:
travis-encrypt -r GH_USER/GH_REPO GH_TOKEN=GITHUB_ACCESS_TOKENand then copy into.travis.yml
- If using the ruby gem:
- This is used to give Travis write access to your Git repository,
and will be used to push to the
gh-pagesbranch
Default: None - throws when not set
GH_USER
String (Environment Variable)
Github user or organisation name
Default: First half of `REPO_SLUG`