0

I have a requirement for some very basic static file hosting, something that GitHub pages can easily handle - HTML & images only.

However the HTML and images are generate in a Travis-CI test script - so after the travis build is done, I want it to push a directory of artifacts back into Github.

Preferably into a git repo different to the one that triggered the build, but within the same GitHub organisation.

I know I can probably write a script that does the pull and push into the repo, but I'm unsure if I need to give travis extra keys or hooks.

Is this possible?

  • I think you'll find most your answers at http://stackoverflow.com/questions/26020494/automated-push-to-a-github-repo-with-travis . – ocean Nov 29 '16 at 07:24
  • GitHub Pages offers static hosting if you are interested in going down that path. – osowskit Nov 29 '16 at 16:51
  • I know about static pages, I just want to know if I can uploaded to a set of static pages easily via Traivs-CI –  Nov 29 '16 at 20:38
  • 2
    I see. They added the ability to [publish from a `/docs` folder](https://github.com/blog/2228-simpler-github-pages-publishing). You can check in using a Deploy key. – osowskit Dec 11 '16 at 04:52

1 Answers1

0

Travis now supports deployment to github pages in a simplest way, see: https://docs.travis-ci.com/user/deployment/pages

An example that works for my repository (https://github.com/amadeubarbosa/openbus-collaboration-service):

# Install dependencies
addons:
  apt:
    packages:
      - doxygen
      - doxygen-doc
      - doxygen-latex
      - doxygen-gui
      - graphviz

script:
  - cd docs
  - doxygen collab.dox

deploy:
  provider: pages
  skip_cleanup: true
  local_dir: $TRAVIS_BUILD_DIR/docs/html
  github_token: $GITHUB_API_KEY
  on:
    branch: master

You must configure a github API Key to integrate Travis and Github, so Travis will push to gh-pages branch like a charm. Finally, you must configure your repository to show the pages from gh-pages branch.

Amadeu Barbosa
  • 314
  • 2
  • 6