-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.R
24 lines (21 loc) · 925 Bytes
/
deploy.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# from https://blog.rmhogervorst.nl/blog/2021/02/27/deploy-to-shinyapps-io-from-github-actions/
library(rsconnect)
# a function to stop the script when one of the variables cannot be found. and to strip quotation marks from the secrets when you supplied them. (maybe it is just easier to never use them)
error_on_missing_name <- function(name){
var <- Sys.getenv(name, unset=NA)
if(is.na(var)){
stop(paste0("cannot find ",name, " !"),call. = FALSE)
}
gsub("\"", '',var)
}
# Authenticate
setAccountInfo(name = error_on_missing_name("SHINY_ACC_NAME"),
token = error_on_missing_name("TOKEN"),
secret = error_on_missing_name("SECRET"))
# Deploy the application.
deployApp(
appFiles = c("app.R" #, you can specify which files to deploy,
#or keep this NULL to deploy everything
),
appName = error_on_missing_name("MASTERNAME"),
appTitle = "shinyapplication")