Skip to content

Merge pull request #28 from dfe-analytical-services/eesp/bugfix/deplo… #107

Merge pull request #28 from dfe-analytical-services/eesp/bugfix/deplo…

Merge pull request #28 from dfe-analytical-services/eesp/bugfix/deplo… #107

Workflow file for this run

on:
push:
branches:
- master
- development
pull_request:
branches:
- master
- development
name: deploy-shiny
jobs:
deployShiny:
runs-on: ${{ matrix.config.os }}
name: deploy (${{ matrix.config.os }} ${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
RENV_PATHS_ROOT: ~/.local/share/renv
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
r-version: 4.4.1
- name: Set env vars (dev)
if: endsWith(github.ref, '/development')
run: |
echo "SHINYAPP_NAME='dev-ks5-transition-matrices'" >> $GITHUB_ENV
- name: Set env vars (prod)
if: endsWith(github.ref, '/main')
run: |
echo "SHINYAPP_NAME='ks5-transition-matrices'">> $GITHUB_ENV
- name: Install processx
shell: Rscript {0}
run: |
install.packages("processx")
- name: restore renv
uses: r-lib/actions/setup-renv@v2
- 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 Stats Development team if you need to add the below secrets to publish to shinyapps.io
- name: Push to shiny.io
if: github.event_name != 'pull_request'
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)"