Getting travis to deploy pkgdown pages as part of the CI is not straightforward and should be better documented...
@thomasp85 I'm using rudely your issue as an opportunity to mention https://github.com/ropenscilabs/travis/
If you do
usethis::use_pkgdown()
travis::use_tic()
It works like magic (making you browse the right pages). ✨ Last time I've used it was for cransays https://itsalocke.com/blog/cransays---follow-your-r-package-journey-to-cranterbury-with-our-dashboard/ and it worked so well.
End of promotion. 👼
You are right insofar that it works if you own and work from the main repository. If you work from a fork it less apparent as you currently have to change the tracking branch for the travis package to pick up the right repo to add deployment settings to.
Ah yes, I was definitely describing an easy use case! 🙈
@maelle we don't use tic as part of our standard workflow.
@thomasp85 this should now be documented at https://pkgdown.r-lib.org/reference/deploy_site_github.html. Please file issues there if you notice anything missing.
May want to add that, following this procedure, the pkgdown site will be available at: http(s)://[username].github.io/[projectname]
I find that original point expressed by @thomasp85:
Getting travis to deploy pkgdown pages as part of the CI is not straightforward and should be better documented...
is still valid. I have followd the configruation available through ?pkgdown::deploy_site_github; however, Travis was returning the following error:
Deploying application
Error: No built tarball detected, please provide the location of one with `tarball`
Execution halted
Script failed with status 1
failed to deploy
It seems that the PKG_TARBALL variable used in deploy_site_github wasn't exported.
tarball = Sys.getenv("PKG_TARBALL", "")
I attempted fixing that by expanding the before_deploy in the manner shown below that I've sourced from travis configuration that I found online.
before_deploy:
- Rscript -e 'remotes::install_cran("pkgdown")'
- R CMD INSTALL .
- export PKG_TARBALL=$(Rscript -e 'pkg <- devtools::as.package("."); cat(paste0(pkg$package,"_",pkg$version,".tar.gz"))')
so far with no luck. I reckon that other elements of my .travis.yml may be problematic but more comprehensive documentation creating suitable configuration would help.
@konradzdeb It sounds like what you're talking about is best brought up on the pkgdown package repo itself, since you're really talking about pkgdown::deploy_site_github(). usethis just provides a high-level wrapper for the setup.
That being said, a lot of people do actually succeed with usethis::use_pkgdown(). I suspect one source of failure is different initial states and other setup that departs from what we expect/do. For example, the line R CMD INSTALL . would be very unusual in our standard .travis.yml files. Here's the entire build matrix for usethis, which also successfully builds and deploys the pkgdown website:
matrix:
include:
- r: devel
- r: release
after_success: Rscript -e 'covr::codecov()'
before_deploy: Rscript -e 'remotes::install_cran("pkgdown")'
deploy:
provider: script
script: Rscript -e 'pkgdown::deploy_site_github()'
skip_cleanup: true
- r: oldrel
- r: 3.4
- r: 3.3
- r: 3.2
Hi @konradzdeb
Now I got completely same error as you got, below.
Error: No built tarball detected, please provide the location of one with `tarball`
Could you share how to resolve it?