Skip to content

Commit

Permalink
add deployment action
Browse files Browse the repository at this point in the history
  • Loading branch information
KKulma committed Mar 22, 2021
1 parent c366018 commit 997efa3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: append daily CI data

on: push
jobs:
run_container:
runs-on: ubuntu-latest
container:
image: kasiatemp/ng-update:shiny
env:
SHINY_ACC_NAME=${{secrets.SHINY_ACC_NAME}}
TOKEN=${{secrets.TOKEN}}
SECRET=${{secrets.SECRET}}
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: 'main'
- name: Deploy app
run: |
bash Rscript deploy.R
File renamed without changes.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
carbon-intensity-app.Rproj
rsconnect/
.DS_Store
.Renviron
20 changes: 20 additions & 0 deletions deploy.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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(appName = "carbon-intensity-app",
appTitle = "Carbon Intensity App")

0 comments on commit 997efa3

Please sign in to comment.