Project Site

You can easily deploy a cobalt site to gh-pages! To do this with travis is also very easy.

  1. Create your .travis.yml file:
sudo: false
  - curl -LSfs |
    sh -s --
    --git cobalt-org/
    --crate cobalt
    --target x86_64-unknown-linux-gnu
    --tag v0.15.0
  - export PATH="$PATH:~/.cargo/bin"
  - cobalt build

  provider: pages
  skip_cleanup: true
  github_token: $GH_TOKEN
  local_dir: _site
  target_branch: master
    branch: source
  • --tag: update to reflect the desired version of cobalt.

  • local_dir: update it according to your destination

  • target_branch: Update to reflect the branch that you configured as the source for Github Pages.

  • on: branch: Update to reflect the branch your source is kept in.

  1. Configure your GH_TOKEN

This is a limited access API token for Travis to commit to your page's github repo. You can create one here.

To add it to your .travis.yml file, you will need to use the travis cli tool. This will encrypt the token specifically to your repo and branch.

Example: travis encrypt GH_TOKEN=... --add

Personal or Organization Site

The main difference with a personal site is that github only allows the master branch to serve the pages. Instead, you could keep your source in another branch, like source and have cobalt import your site into the master branch.

GitLab CI

You can also deploy a cobalt site to Gitlab Pages using GitLab CI. GitLab CI uses Docker, so there are many ways to accomplish building your cobalt site.

This example .gitlab-ci.yml installs and runs cobalt:

image: debian:latest

  COBALT_VERSION: "v0.15.0"
  - apt-get update && apt-get -y install curl
  - curl -LSfs |
    sh -s --
    --git cobalt-org/
    --crate cobalt
    --target x86_64-unknown-linux-gnu
  - export PATH="$PATH:~/.cargo/bin"
  - mkdir -p public
  - cobalt build -d public
    - public/
  - master


To import your site to your gh-pages branch you can either pass a build --import flag when you build the site or after you have build the site with build you can run import. There are also some flags that can be found via import --help.