Skip to content

Commit

Permalink
GitHub Action for ShinyApps deployment (#61)
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
  • Loading branch information
NeuroShepherd authored Feb 13, 2024
1 parent b2ce682 commit e6635c0
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/shiny-deploy-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
workflow_dispatch:

name: shiny-deploy

jobs:
shiny-deploy:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4

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

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

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

- name: Install rsconnect
run: install.packages("rsconnect")
shell: Rscript {0}

- name: Authorize and deploy app
env:
# Provide your app name, account name, and server to be deployed below
APPNAME: ordinalsimr
# ACCOUNT: your-account-name
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 }}")
shell: Rscript {0}

0 comments on commit e6635c0

Please sign in to comment.