A static site generator written in Rust



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.


Project Site

You can easily deploy a cobalt site to gh-pages! To do this with travis is also very easy. You will need to have rust available on travis. In your travis.yml you will need to have something similar to this:

sudo: false
language: rust

  - cargo install cobalt-bin
  - export PATH="$PATH:/home/travis/.cargo/bin"

  - cobalt build

after_success: |
  [ $TRAVIS_BRANCH = master ] &&
  [ $TRAVIS_PULL_REQUEST = false ] &&
  cobalt import &&
  git config user.name "Cobalt Site Deployer" &&
  git config user.email "name@example.com" &&
  git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages

For the GH_TOKEN you will need to create a personal access token, which can be found here, then you will need to use the travis cli tool to encrypt your personal access token. You can do this like so travis encrypt GH_TOKEN=... --add env.global

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, you can use nott/cobalt or any other image with cobalt in PATH.

An example of .gitlab-ci.yml:

image: nott/cobalt:latest

  - mkdir -p public
  - cobalt build -d public
    - public/
  - master