GitHub - drdoctr/doctr: A tool for automatically deploying docs from Travis CI to GitHub pages. (original) (raw)

Doctr

A tool for automatically deploying docs from Travis CI to GitHub pages.

Doctr helps deploy things to GitHub pages from Travis CI by managing the otherwise complicated tasks of generating, encrypting, managing SSH deploy keys, and syncing files to the gh-pages branch. Doctr was originally designed for documentation, but it can be used to deploy any kind of website to GitHub pages that can be built on Travis CI. For example, you can use Doctr to deploy a blogor website that uses a static site generator.

Contribute to Doctr development on GitHub.

Installation

Install Doctr with pip

pip install doctr

or conda

conda install -c conda-forge doctr

Note that Doctr requires Python 3.5 or newer.

Usage

Run Doctr configure

First use Doctr to generate the necessary key files so that travis can push to your gh-pages (or other) branch.

Run

doctr configure

and enter your data. You will need your GitHub username and password, and the repo organization / name for which you want to build the docs.

Note: That repo should already be set up with Travis. We recommend enablingbranch protectionfor the gh-pages branch and other branches, as the deploy key used by Doctr has the ability to push to any branch in your repo.

Edit your travis file

Doctr will output a bunch of text as well as instructions for next steps. You need to edit your .travis.yml with this text. It contains the secure key that lets travis communicate with your GitHub repository, as well as the code to run (in script:) in order to build the docs and deploy Doctr.

Your .travis.yml file should look something like this:

Doctr requires python >=3.5

language: python python:

This gives Doctr the key we've generated

sudo: false env: global: secure: ""

This is the script to build the docs on travis, then deploy

script:

See the travis config file used by Doctr itself for example.

You can deploy to a different folder by giving it a different path in the call to deploy. E.g., doctr deploy docs/.

If you don't already have a gh_pages branch Doctr will make one for you.

Warning

Be sure to add set -e in script, to prevent doctr from running when the docs build fails.

Put doctr deploy . in the script section of your .travis.yml. If you use after_success, it will not causethe build to fail.

Commit your new files and build your site

doctr configure will create a new file that contains your key. Commit this as well as the changes to .travis.yml. Once you push to GitHub, travis should now automatically build your documentation and deploy it.

Notes

Doctr requires Python 3.5 or newer. Be sure to run it in a Python 3.5 or newer section of your build matrix. It should be in the same build in your build matrix as your docs build, as it reuses that.

Doctr does not require Sphinx. It will work with deploying anything to GitHub pages. However, if you do use Sphinx, Doctr will find your Sphinx docs automatically (otherwise use doctr deploy . --built-docs <DOCS PATH>).

FAQ

Projects using Doctr

Are you using Doctr? Please add your project to the list!