Auto-deploying documentation: better change tracking of artefacts
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
As part of my never-ending quest to deploy documentation better, I’ve made yet another tweak to my scripts that deploy R vignettes or Rmarkdown documents to the gh-pages
branch of my github repositories via Travis-CI.
The script from Robert Flight that’s provided the basis for most of this work does something specific to update the web facing branch of the repository. It would:
1. Create a blank repository
2. Add the requisite files to the repository
3. Add and commit them to the repo
4. Force the repo to overwrite the gh-pages
branch
This had the unfortunate consequence of losing the history of what was previously hosted on the branch and could not tell me what commit to my development branches was responsible for a version of the docs. It took a little bit of playing but the revised script now:
1. Clones the gh-pages branch
2. Adds the requisite files into the reports
3. Add and commit them to the repo
4. Push the changes
Using an environment variable ($TRAVIS_COMMIT) the commit message is the commit ID for the latest commit in the build that occurs on Travis, making it very easy to see what changes triggered a documentation update.
This version is designed to extract generated vignettes, but the principal holds for any generated files.
#!/bin/bash rm -rf out || exit 0; mkdir out; GH_REPO="@github.com/stephlocke/RMSFTDP.git" FULL_REPO="https://$GH_TOKEN$GH_REPO" for files in '*.tar.gz'; do tar xfz $files done git clone https://github.com/stephlocke/RMSFTDP.git out --branch gh-pages cd out git config user.name "stephs-travis" git config user.email "travis" for files in '../RMSFTDP/inst/doc/*.html'; do cp $files . done git add . git commit -m "$TRAVIS_COMMIT" git push --quiet $FULL_REPO
Posts in this series
- Automated documentation hosting on github via Travis-CI
- Auto-deploying documentation: multiple R vignettes
- Auto-deploying documentation: FASTER!
- Auto-deploying documentation: Rtraining
- Auto-deploying documentation: better change tracking of artefacts
The post Auto-deploying documentation: better change tracking of artefacts appeared first on It's a Locke.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.