Skip to content

Commit 5190fc0

Browse files
authored
Merge pull request #6 from NHS-Transformation-Unit/aw_dev
Fix for yaml deployment of shinyapps
2 parents 1605272 + 4a093f5 commit 5190fc0

File tree

1 file changed

+30
-24
lines changed

1 file changed

+30
-24
lines changed

.github/workflows/deploy-shiny.yml

+30-24
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
1+
name: Deploy Shiny App to shinyapps.io
2+
13
on:
24
push:
3-
branches:
4-
- main
5-
6-
name: Deploy template app to shinyapps.io
5+
branches:
6+
- main # Trigger when code is pushed to main branch
77

88
jobs:
9-
deploy-shiny:
10-
name: Deploy to shinyapps.io
11-
runs-on: ubuntu-latest
12-
env:
13-
GITHUB_PAT: ${{ secrets.ACCESS_TOKEN }}
14-
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
15-
9+
deploy:
10+
name: Publish to shinyapps.io
11+
runs-on: ubuntu-latest # Use the latest Ubuntu image
12+
1613
steps:
17-
- name: 🛎️ Checkout repository
18-
uses: actions/checkout@v4
19-
with:
20-
fetch-depth: 0
21-
- id: deploy
22-
name: 💎 Deploy to shinyapps.io
23-
uses: qwert666/shinyapps-actions@main
24-
env:
25-
SHINY_USERNAME: ${{ secrets.SHINYAPPS_ACCOUNT }}
26-
SHINY_TOKEN: ${{ secrets.SHINYAPPS_TOKEN }}
27-
SHINY_SECRET: ${{ secrets.SHINYAPPS_SECRET }}
28-
APP_NAME: 'markov_example'
29-
14+
# Step 1: Checkout the repository
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
# Step 2: Set up R environment
19+
- name: Set up R
20+
uses: r-lib/actions/setup-r@v2
21+
22+
# Step 3: Install rsconnect and dependencies
23+
- name: Install rsconnect and dependencies
24+
run: |
25+
R -e 'install.packages("rsconnect")'
26+
27+
# Step 4: Deploy the Shiny app
28+
- name: Deploy app to shinyapps.io
29+
env:
30+
SHINYAPPS_ACCOUNT: ${{ secrets.SHINYAPPS_ACCOUNT }}
31+
SHINYAPPS_TOKEN: ${{ secrets.SHINYAPPS_TOKEN }}
32+
SHINYAPPS_SECRET: ${{ secrets.SHINYAPPS_SECRET }}
33+
run: |
34+
R -e 'rsconnect::setAccountInfo(name="${{ secrets.SHINYAPPS_ACCOUNT }}", token="${{ secrets.SHINYAPPS_TOKEN }}", secret="${{ secrets.SHINYAPPS_SECRET }}")'
35+
R -e 'rsconnect::deployApp(appDir = ".", appName = "YOUR_APP_NAME")'

0 commit comments

Comments
 (0)