Skip to content

Commit

Permalink
Fix deployment action to ShinyApps (#63)
Browse files Browse the repository at this point in the history
* Change triggers for running R CMD checks

Run checks only on pushes (i.e. when a branch is merged--this necessarily creates a push) to the master and development branches. Enable workflow dispatching for any branch.

* Don't autorun on push to development

* Set up ShinyApps io deployment action (#60)

Deploys only the master branch. Consider a development deployment in the future

* Install libgit2-dev in action workflow

* Fix typo in action

* Add account name attempt

* Update renv dependencies for action

* Remove browser call

* Force updates to Shiny site

* Use golem fix for deploying to shinyapps.io
  • Loading branch information
NeuroShepherd authored Feb 13, 2024
1 parent e6635c0 commit ae0615a
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ $run_dev.*
^README\.Rmd$
^LICENSE\.md$
^\.github$
^app\.R$
^rsconnect$
7 changes: 5 additions & 2 deletions .github/workflows/shiny-deploy-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
with:
use-public-rspm: true

- name: Install libgit2-dev
run: sudo apt-get install -y libgit2-dev

- uses: r-lib/actions/setup-renv@v2

- name: Install rsconnect
Expand All @@ -31,9 +34,9 @@ jobs:
env:
# Provide your app name, account name, and server to be deployed below
APPNAME: ordinalsimr
# ACCOUNT: your-account-name
ACCOUNT: 6fcd1k-pat
SERVER: shinyapps.io # server to deploy
run: |
rsconnect::setAccountInfo("${{ secrets.RSCONNECT_USER }}", "${{ secrets.RSCONNECT_TOKEN }}", "${{ secrets.RSCONNECT_SECRET }}")
rsconnect::deployApp(appName = "${{ env.APPNAME }}", account = "${{ env.ACCOUNT }}", server = "${{ env.SERVER }}")
rsconnect::deployApp(appName = "${{ env.APPNAME }}", account = "${{ env.ACCOUNT }}", server = "${{ env.SERVER }}", forceUpdate = TRUE)
shell: Rscript {0}
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Imports:
glue,
golem (>= 0.4.0),
magrittr,
pkgload,
purrr,
rhandsontable,
rlang,
Expand Down
3 changes: 3 additions & 0 deletions R/_disable_autoload.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Disabling shiny autoload

# See ?shiny::loadSupport for more information
1 change: 0 additions & 1 deletion R/mod_save_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ mod_save_data_server <- function(id, input_data, processed_data, input, output,
# shinyFileSave(input, "save_results", roots = "home")

data_to_save <- reactive({
browser()
list(
comparison_data = format_simulation_data(input_data$comparison_results()) %>%
append(list(distribution_statistics = processed_data$distribution_statistics(),
Expand Down
7 changes: 7 additions & 0 deletions app.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Launch the ShinyApp (Do not remove this comment)
# To deploy, run: rsconnect::deployApp()
# Or use the blue button on top of this file

pkgload::load_all(export_all = FALSE,helpers = FALSE,attach_testthat = FALSE)
options( "golem.app.prod" = TRUE)
ordinalsimr::run_app() # add parameters here (if any)
12 changes: 6 additions & 6 deletions renv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1644,14 +1644,14 @@
},
"rlang": {
"Package": "rlang",
"Version": "1.1.1",
"Version": "1.1.3",
"Source": "Repository",
"Repository": "CRAN",
"Repository": "RSPM",
"Requirements": [
"R",
"utils"
],
"Hash": "a85c767b55f0bf9b7ad16c6d7baee5bb"
"Hash": "42548638fae05fd9a9b5f3f437fbbbe2"
},
"rmarkdown": {
"Package": "rmarkdown",
Expand Down Expand Up @@ -1756,9 +1756,9 @@
},
"rsconnect": {
"Package": "rsconnect",
"Version": "1.1.0",
"Version": "1.2.1",
"Source": "Repository",
"Repository": "RSPM",
"Repository": "CRAN",
"Requirements": [
"R",
"cli",
Expand All @@ -1774,7 +1774,7 @@
"tools",
"yaml"
],
"Hash": "ec53d658cf0abbd7cd7ce2d6b9d70337"
"Hash": "94bb3a2125b01b13dd2e4a784c2a9639"
},
"rstudioapi": {
"Package": "rstudioapi",
Expand Down

0 comments on commit ae0615a

Please sign in to comment.