Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic site building and deployments with mkdocs #137

Open
Richienb opened this issue Jun 17, 2018 · 2 comments
Open

Automatic site building and deployments with mkdocs #137

Richienb opened this issue Jun 17, 2018 · 2 comments

Comments

@Richienb
Copy link

Richienb commented Jun 17, 2018

I've noticed that you have setup your .travis.yml file to only check for build runtime errors but you can also deploy the site if the build succeeds

Just change the script section to:

before_deploy:
  - mkdocs build --verbose --clean --strict

And add a deploy section:

deploy:
  provider:        pages
  skip_cleanup:    true
  github_token:    $github_token
  local_dir:       site
  on:
    branch:        master

Also, after adding a no sudo and bumping the python version, your .travis.yml file will look like this:

sudo: false

language: python

python: "3.6.5"

install:
    - pip install mkdocs

before_deploy:
    - mkdocs build --verbose --clean --strict

deploy:
  provider:        pages
  skip_cleanup:    true
  github_token:    $github_token
  local_dir:       site
  on:
    branch:        master

Now follow these steps for setting the github_token variable in Travis CI

  1. Go to the settings of your account
  2. Click on Developer settings
  3. Click on Personal access tokens
  4. Click Generate new token
  5. You may need to enter your Github password at this point
  6. Name the token something under Token description (it doesn't matter)
  7. Enable the public_repo scope/permission
  8. Click Generate token at the bottom of the page
  9. Go to the settings of the target Travis CI repository
  10. Create an environmental variable with the following settings: | name: github_token | value: Your Token | Display value in build log: No
  11. Press add

That's it. For more help, read my stackoverflow Q&A or just ask below.

@KatherineMichel
Copy link
Member

Hi @Richienb! Thank you for this info. We are actually switching from Travis CI to Circle CI. Many of our apps have already been switched. We are considering using continuous deployment to deploy packages to PyPi when a tagged release happens. This is something to consider as well.

@Richienb Richienb changed the title Mkdocs Automatic Site Building And Deploy Automatic site building and deployments with mkdocs Aug 4, 2018
@KatherineMichel
Copy link
Member

Although we are moving away from Travis CI, I think this is a great idea. Here is an article with some info about auto deploy using Circle CI. Does not use mkdocs, but does use Sphinx. See #150. https://circleci.com/blog/deploying-documentation-to-github-pages-with-continuous-integration/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants