CorrelAid / kbtbr

https://correlaid.github.io/kbtbr
Other
7 stars 1 forks source link

[#2] | Add pkgdown documentation #44

Closed MKyhos closed 3 years ago

MKyhos commented 3 years ago

description from @friep

adds pkgdown documentation for branches dev and main.

They will be available at:

a preview is available for the pkgdown branch: https://correlaid.github.io/kbtbr/pkgdown

how does it work?

  1. Github action extracts the name of the branch and writes _pkgdown.yml so that /tmp/docs/{branch_name} is the destination folder for the build. Note that this is a temporary directory outside of the repository.
  2. install package
  3. build site to the temp directory from step 1. checkout the _pkgdown.yml to reset it to its empty state, then checkout the gh-pages branch
  4. delete folder in docs/{branch_name} if it exists. move the temp directory to its place with mv.
  5. commit the updated docs/{branch_name} folder to the gh-pages branch.

one of the main challenges was that building the page would introduce changes in git - and then trying to checkout the gh-pages branch would result in git not being able to checkout the gh-pages branch with the following error: "Your local changes to the following files would be overwritten by checkout: ... Please commit your changes or stash them before you switch branches.". This is why we now build to a place outside git first, then checkout the gh-pages branch and copy in the new build. kind of dirty but it avoids having anything unstaged when checking out the branch.

pr130 commented 3 years ago

@MKyhos was that intentional that the PR goes against main? :)

MKyhos commented 3 years ago

No it wasn't (edit but it would probably make no harm either. However, will close the pr later and reopen )

pr130 commented 3 years ago

@MKyhos no worries, i just changed the base to dev (they added that a couple of months ago that you can change that.. phew). if we want to merge it to main, that's also fine with me, i just don't want to have all the cran checks running all the time (edit: for now)

pr130 commented 3 years ago

i think it's working now? 👀 should we redirect https://correlaid.github.io/kbtbr/ to https://correlaid.github.io/kbtbr/main ?

MKyhos commented 3 years ago

Very nice, very nice! :clap: :bow: Thank you so much!

RE redirection: either that, or we polish the current landing page accordingly such that it is nice to view and select the version of the documentation for the users :thinking: