Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write rsconnect manifest in build_site() deploy_to_branch() #1611

Closed
wlandau opened this issue Apr 5, 2021 · 5 comments
Closed

Write rsconnect manifest in build_site() deploy_to_branch() #1611

wlandau opened this issue Apr 5, 2021 · 5 comments
Labels
deploy ✈️ feature a feature request or enhancement

Comments

@wlandau
Copy link

@wlandau wlandau commented Apr 5, 2021

Would you be open to creating a manifest.json file as part of build_site() or deploy_to_branch()?

My team and I heavily use RStudio Connect, and we love Git-backed content. Thanks to pkgdown::deploy_to_branch() and usethis::use_github_action("pkgdown"), it is almost trivially easy to continuously deploy a package site on Connect. The only snag is that it requires manifest.json at the top level, and pkgdown does not currently create one. My personal workaround is to run build_site() locally, run rsconnect::writeManifest() from inside docs/, then copy manfiest.json to pkgdown/favicon/. It works, but the extra steps add friction for colleagues who are just getting into package development.

@wlandau wlandau changed the title Write rsconnect manifest in deploy_to_branch() Write rsconnect manifest in build_site() deploy_to_branch() Apr 5, 2021
@wlandau
Copy link
Author

@wlandau wlandau commented May 4, 2021

My personal workaround is to run build_site() locally, run rsconnect::writeManifest() from inside docs/, then copy manfiest.json to pkgdown/favicon/. It works, but the extra steps add friction for colleagues who are just getting into package development.

On reflection, I am not actually sure if that workaround is reasonable because manfest.json lists all the current files and hashes of the project, and those usually change when the site is rebuilt.

@wlandau
Copy link
Author

@wlandau wlandau commented May 5, 2021

My best workaround so far is to include a package function that generates the manifest when the examples run during deploy_to_branch(). learnr tutorials and NEWS.md do not make it into the manifest, so Connect does not display them, but otherwise it seems to work.

#' @title Write a manifest file.
#' @export
#' @description Not a user-side function.
#' @details Writes a `manifest.json` file so the `pkgdown` site
#'   can be deployed to RStudio Connect as Git-backed content.
#' @return `NULL` (invisibly).
#' @examples
#' zzz_examplepkg_write_manifest()
zzz_examplepkg_write_manifest <- function() {
  if (pkgdown::in_pkgdown()) {
    withr::with_dir(
      "..",
      rsconnect::writeManifest(
        appPrimaryDoc = "index.html",
        contentCategory = "site"
      )
    )
  }
}

@hadley hadley added deploy ✈️ feature a feature request or enhancement labels Sep 21, 2021
@hadley
Copy link
Member

@hadley hadley commented Sep 24, 2021

Where are you running deploy_to_branch()? I'm thinking that this function currently does too much (and is a little buggy with complicated git setups) so we're probably going to move away from it in favour of a function that builds the site, and then leaves the deployment up to you.

@wlandau
Copy link
Author

@wlandau wlandau commented Sep 27, 2021

Yes, I was thinking during deploy_to_branch(): after the site is built and before it is deployed.

I do see your point that it is already a big function and difficult to maintain. From a user perspective though, I really enjoy the automatic deployment because those Git setups are indeed complicated. Will some form of support continue in this package? (Or some other r-lib package)?

@hadley
Copy link
Member

@hadley hadley commented Sep 27, 2021

For GitHub actions, we'll move to https://github.com/marketplace/actions/deploy-to-github-pages. Otherwise, no plans to replicate deploy_to_branch() elsewhere. But it's unlikely to change, so I'd suggest just copying and pasting the contents into your own function that also calls writeManifest().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy ✈️ feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants