Auto-deploying documentation: better change tracking of artefacts

[This article was first published on R – It's a Locke, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
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

  1. Automated documentation hosting on github via Travis-CI
  2. Auto-deploying documentation: multiple R vignettes
  3. Auto-deploying documentation: FASTER!
  4. Auto-deploying documentation: Rtraining
  5. 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.

To leave a comment for the author, please follow the link and comment on their blog: R – 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.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)