-
Notifications
You must be signed in to change notification settings - Fork 4
55 lines (46 loc) · 1.98 KB
/
deploy-shinyapps-io.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
name: shinyapps-io-deploy
on:
pull_request:
types:
- closed
workflow_dispatch:
jobs:
shinyapps-io-deploy:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y pip python3-venv libcurl4-openssl-dev
- uses: actions/checkout@v2
- name: disable renv
run: |
rm .Rprofile
rm renv.lock
rm -rf renv
- name: Install R packages
run: |
# The binary package distributions from R Studio dramatically speed up installation time
options(repos = c(REPO_NAME = "https://packagemanager.rstudio.com/all/__linux__/focal/latest",
getOption("repos")))
install.packages(c("dplyr", "purrr", "reactable", "shiny", "rsconnect", "rjson", "httr"))
shell: sudo Rscript {0} # running this step as 'sudo' is necessary to be able to install packages in default library
- name: Authorize and deploy app
run: |
branch<-Sys.getenv("GITHUB_REF_NAME")
repo<-Sys.getenv("GITHUB_REPOSITORY")
appName<-strsplit(repo, "/")[[1]][2]
if (!startsWith(branch, "prod")) {
appName = paste(appName, "staging", sep="-")
}
rsConnectUser <-"${{ secrets.RSCONNECT_USER }}"
rsConnectToken <- "${{ secrets.RSCONNECT_TOKEN }}"
rsConnectSecret <- "${{ secrets.RSCONNECT_SECRET }}"
rsconnect::setAccountInfo(rsConnectUser, rsConnectToken, rsConnectSecret)
appFiles<-dir(all.files=TRUE, include.dirs=TRUE)
rsconnect::deployApp(appName = appName, appFiles=appFiles)
# important NOT to run this step as sudo, otherwise env var's will be missing
shell: Rscript {0}