1.7 KiB
permalink | title | published_date | layout | data | ||
---|---|---|---|---|---|---|
/{{ year }}/{{ month }}/{{ day }}/github-pages-deployment-made-easy | GitHub Pages deployment made easy | 2017-11-17 19:47:15 +0100 | post.liquid |
|
Recently I tried to deploy a new Cobalt-powered site from Travis CI, using the then documented method. It failed at random and all tries to debug it failed.
That's when I came across Travis' GitHub Pages Deployment integration.
Add the following snippet to your .travis.yml
:
deploy:
provider: pages
skip_cleanup: true
github_token: $GH_TOKEN
local_dir: build
on:
branch: master
Now create a new Personal Access Token on GitHub and make sure to include the public_repo
scope (or the repo
scope if you're deploying from a private repository).
Copy the provided token and execute the following code in a shell:
travis encrypt GH_TOKEN=thetokenyougot --add env.global
(make sure to replace thetokenyougot
with the actual token)
Now whenever you push to the master
branch, Travis will run your build first, then grab all files from the build
folder, put that into a new commit in the gh-pages
branch and force-push to GitHub again.
For more settings check the linked documentation (e.g. how to change the folder or branch to be deployed).
Meanwhile, this became the documented method for Cobalt deployment.