Skip to content

add GA tag back in (missed that the automatic removal had triggered i… #151

add GA tag back in (missed that the automatic removal had triggered i…

add GA tag back in (missed that the automatic removal had triggered i… #151

Workflow file for this run

on:
push:
branches:
- main
- development
name: shinyapps.io deploy
jobs:
deployShiny:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Set env vars (dev)
if: endsWith(github.ref, '/development')
run: |
echo "SHINYAPP_NAME='dev-dfe-shiny-template'" >> $GITHUB_ENV
echo "SHINYAPP_OVERFLOW_NAME='dev-dfe-shiny-template-overflow'">> $GITHUB_ENV
- name: Set env vars (prod)
if: endsWith(github.ref, '/main')
run: |
echo "SHINYAPP_NAME='dfe-shiny-template'">> $GITHUB_ENV
echo "SHINYAPP_OVERFLOW_NAME='dfe-shiny-template-overflow'">> $GITHUB_ENV
- name: Restore renv snapshot
shell: Rscript {0}
run: |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv")
renv::restore()
- name: Install rsconnect
shell: Rscript {0}
run: |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv")
renv::install("rsconnect")
# Tokens are stored as secrets in GitHub to make sure only DfE analysts can publish apps in our shiny.io area
# Navigate to Settings > Secrets to add and view secrets. These can also be things like admin login and passwords for SQL databases.
# Get in touch with the Explore education statistics platforms team if you need to add the below secrets to publish to shinyapps.io
- name: Push to shiny.io
run: >
Rscript
-e "rsconnect::setAccountInfo(name = 'department-for-education', token = '${{secrets.SHINYAPPS_TOKEN}}', secret = '${{secrets.SHINYAPPS_SECRET}}')"
-e "rsconnect::deployApp(appName=${{env.SHINYAPP_NAME}}, forceUpdate = TRUE)"
-e "rsconnect::deployApp(appName=${{env.SHINYAPP_OVERFLOW_NAME}}, forceUpdate = TRUE)"