You can easily deploy a cobalt site to
gh-pages! To do this with travis is
also very easy.
- Create your
sudo: false before_script: - curl -LSfs https://japaric.github.io/trust/install.sh | sh -s -- --git cobalt-org/cobalt.rs --crate cobalt --force --target x86_64-unknown-linux-gnu - export PATH="$PATH:~/.cargo/bin" script: - cobalt build deploy: provider: pages skip_cleanup: true github_token: $GH_TOKEN local_dir: build target_branch: master on: branch: source
local_dir: update it according to your
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.
- Configure your
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.
travis encrypt GH_TOKEN=... --add env.global
Personal or Organization Site
The main difference with a personal site is that github only allows
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
An example of
image: nott/cobalt:latest pages: script: - mkdir -p public - cobalt build -d public artifacts: paths: - public/ only: - master
To import your site to your
gh-pages branch you can either
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