This is another note about deploying a
pkgdown
1 website with
Travis on gh-pages. I had
previously used the package
travis
but I was recently
interested in doing so manually. Fortunately, I found this very helpful
walk-through
by Gábor Csárdi2. I used it and it worked
well for a while, but at some point I had an issue with the deployment part
(still not sure why), so I changed it. Instead of using the following
config3
|
|
I now use
|
|
where the environment variable $GITHUB_TOKEN
is a
token
created on GitHub that I have added in the Travis settings of my package. This
works well, BUT it does not allow to keep the two versions of the pkgdown
website (development +
release). This is because a new ./docs
folder is produced during every build
and when its content is pushed to the gh-pages
branch, only one version of the
website is pushed. To overcome this, I have used (and this
thread
was quite helpful).
|
|
Briefly:
mkdir docs
creates the directorydocs
;git fetch origin gh-pages:gh-pages
gets the remotegh-pages
branch;git --work-tree=docs checkout gh-pages -- .
put the content ofgh-pages
in./docs
.
If you want to see this config in action, it is currently used for inSilecoMisc
and so both the release website and the development website are available!
Template
To conclude this note, below is the entire .travis.yaml
template I intend to use for my future packages.
a static website builder for R packages. ↩︎
an important I don’t mention here is actually to create the gh-pages branch. ↩︎
par ot the
.travis.yaml
of my package. ↩︎