There are three ways to deploy a website on your GitHub pages :
- using the
gh-pages
; - using the folder
docs
on your master branch; - using the master branch.
I frequently use the GitHub pages to deploy the pkgdown websites I create for my R packages. For a while, I was using the docs/
folder where the website is generated by default. But I figured that this way has two main drawbacks:
- I needed to rebuild the package locally after (pretty much) any change in the package;
- it adds a huge amount of changes in the commit history.
That’s why I’ve decided to make Travis build the
website and deploy it on the gh-branch
(many developers smartly use this
approach which actually is the default branch for Travis). After tweaking
travis.yml
(see Travis documentation about this) I ran into two problems.
First, I needed a deploy key:
|
|
I read the error message and fixed it 😄!. The second one was slightly more difficult (to me): the gh-branch
had to be empty and as I created gh-pages
from master
it wasn’t! So, I’ve got the following error message:
|
|
see this job if you want to check out the full console log.
Fortunately, the solution to fix this issue is well explained on the pkgdown
website. Following
the guidelines provided there, I was able to solve the two issues described
above 😉!