The repo must have an renv.lock file in the root. Set it up with renv::snapshot()^2^3.
The file shiny-deploy.yaml must be edited.
Look for a the comment: "Provide your app name, account name, and server ..."
In rsconnect::deployApp() use forceUpdate = TRUE to always update the previously-deployed app if there's no deployment record for the app but there's an app with the same name on the server. That is the case when the repo lacks the directory rsconnect/ (e.g. because you never deployed it from your local machine or you removed it).
The repo settings must be configured to add these secrets:
# Get them from shinyapps.io > Tokens
# They map to `name`, `token`, and `secret` of `rsconnect::setAccountInfo()`
RSCONNECT_USER # same as name
RSCONNECT_TOKEN # same as token
RSCONNECT_SECRET # same as secret
A second deployment may fail if the first one is in progress. Just re-run the job on GH Actions.
^1: usethis::use_github_action("check-standard") seems like an overkill. To reduce the iteration time, prune it to the platform used in the server that hosts the app.
^2: Don't run renv::init(). This keeps the app lightweight and maintains the R-package development workflow. Else the workflow-packages (typically used via the general .Rprofile) won't be availabe.
^3: If using renv::init(), then use the implicit approach to discovering dependencies. The explicit one may fail to deploy.
Here I add the basic infrastructure to:
main
(typically via a PR).The process was quite tricky, even with pretty good documentation. To same some time to my future self, below I record some notes.
Overview
Build the general, R-package infrastructure:
usethis::create_package()
usethis::use_upkeep_issue()
^1Build the app-specific infrastructure:
usethis::use_github_action("shiny-deploy")
Details of shiny-deploy
The repo must have an renv.lock file in the root. Set it up with
renv::snapshot()
^2^3.The file shiny-deploy.yaml must be edited.
rsconnect::deployApp()
useforceUpdate = TRUE
to always update the previously-deployed app if there's no deployment record for the app but there's an app with the same name on the server. That is the case when the repo lacks the directory rsconnect/ (e.g. because you never deployed it from your local machine or you removed it).The repo settings must be configured to add these secrets:
A second deployment may fail if the first one is in progress. Just re-run the job on GH Actions.
Resources
usethis::use_github_action("check-standard")
seems like an overkill. To reduce the iteration time, prune it to the platform used in the server that hosts the app.renv::init()
. This keeps the app lightweight and maintains the R-package development workflow. Else the workflow-packages (typically used via the general .Rprofile) won't be availabe.renv::init()
, then use the implicit approach to discovering dependencies. The explicit one may fail to deploy.