Merge pull request #7 from NHS-Transformation-Unit/aw_dev #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Shiny App to shinyapps.io | |
on: | |
push: | |
branches: | |
- main # Trigger when code is pushed to main branch | |
jobs: | |
deploy: | |
name: Publish to shinyapps.io | |
runs-on: ubuntu-latest # Use the latest Ubuntu image | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Step 2: Set up R environment | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
# Step 3: Install rsconnect and dependencies | |
- name: Install rsconnect and dependencies | |
run: | | |
R -e 'install.packages("rsconnect")' | |
# Step 4: Deploy the Shiny app | |
- name: Deploy app to shinyapps.io | |
env: | |
SHINYAPPS_ACCOUNT: ${{ secrets.SHINYAPPS_ACCOUNT }} | |
SHINYAPPS_TOKEN: ${{ secrets.SHINYAPPS_TOKEN }} | |
SHINYAPPS_SECRET: ${{ secrets.SHINYAPPS_SECRET }} | |
run: | | |
R -e 'rsconnect::setAccountInfo(name="${{ secrets.SHINYAPPS_ACCOUNT }}", token="${{ secrets.SHINYAPPS_TOKEN }}", secret="${{ secrets.SHINYAPPS_SECRET }}")' | |
R -e 'rsconnect::deployApp(appDir = ".", appName = "markov_example")' |