I am trying to build and deploy a pkgdown site to my organization's installation of RStudio Connect entirely from within a GitHub Actions workflow. I feel like I am almost there, but I am having trouble with authentication. I looked up my token and secret with rsconnect::accountInfo(), plugged them in as secrets in the GitHub settings page of the repo, and defined the following steps:
- name: Build site
run: pkgdown::build_site(preview = FALSE)
shell: Rscript {0}
- name: Deploy site
run: |
rsconnect::setAccountInfo(
name = Sys.getenv("RSCONNECTNAME"), # registered as a secret in GitHub settings
token = Sys.getenv("RSCONNECTTOKEN"), # registered as a secret in GitHub settings
secret = Sys.getenv("RSCONNECTSECRET") # registered as a secret in GitHub settings
)
withr::with_dir(
"docs",
rsconnect::deployApp(
appDir = ".",
appFiles = list.files(".", recursive = TRUE, all.files = TRUE),
appPrimaryDoc = "index.html",
appId = REDACTED,
appName = REDACTED,
appTitle = REDACTED,
account = Sys.getenv("RSCONNECTNAME"), # registered as a secret in GitHub settings
server = "rstudio-connect.REDACTED.com"
)
)
shell: Rscript {0}
Unfortunately, setAccountInfo() thinks it is going to shinyapps.io instead of rstudio-connect...com, and there is no way to tell it which server it should use. The workflow errors out with this:
Error: HTTP 401
GET https://api.shinyapps.io/v1/users/current/
Unauthorized
When I remove the setAccountInfo() call, I get a different error:
Error: You must register an account using setAccountInfo prior to proceeding.