This repository has been archived by the owner on Mar 12, 2024. It is now read-only.
Update config.json #14
This file contains 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
# Deploy to shinyapps using a pre-built image | |
# Workflow dispatch allows to specify image -- default results in `ghcr.io/gf-dcc/data_curator:latest` | |
# The app name is explicitly specified instead of derived from repo/branch name | |
name: Shortcut shinyapps deploy via image | |
on: | |
push: | |
branches: | |
- staging | |
env: | |
APP_NAME: gf-data-curator-dev | |
DATA_MODEL: https://raw.githubusercontent.com/gf-dcc/data-model/main/GF.jsonld | |
jobs: | |
# TO-DO: Add job to do testing | |
shiny-deploy: | |
runs-on: ubuntu-latest | |
environment: development | |
container: ghcr.io/gf-dcc/data_curator:latest | |
defaults: | |
run: | |
working-directory: /home/app | |
steps: | |
- name: Provide the custom assets (model, configuration, and creds) for schematic | |
shell: bash | |
run: | | |
mkdir data-models | |
curl https://raw.githubusercontent.com/gf-dcc/data-model/main/GF.jsonld > data-models/GF.jsonld | |
curl https://raw.githubusercontent.com/$GITHUB_REPOSITORY/staging/schematic_config.yml > schematic_config.yml | |
sudo chmod -R 777 www | |
curl https://raw.githubusercontent.com/$GITHUB_REPOSITORY/staging/www/config.json > www/config.json | |
echo "${{ secrets.SCHEMATIC_SYNAPSE_CONFIG }}" > .synapseConfig | |
echo "${{ secrets.SCHEMATIC_SERVICE_ACCT_CREDS }}" | base64 --decode > schematic_service_account_creds.json | |
echo ---- App assets to be bundled for deployment ---- | |
ls -a | |
- name: Authorize and deploy app | |
shell: Rscript {0} | |
run: | | |
appName <- "${{ env.APP_NAME }}" | |
rsConnectUser <- "${{ secrets.RSCONNECT_USER }}" | |
rsConnectToken <- "${{ secrets.RSCONNECT_TOKEN }}" | |
rsConnectSecret <- "${{ secrets.RSCONNECT_SECRET }}" | |
# create config file | |
config <- "CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}" | |
config <- c(config, "CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}") | |
appUrl <- sprintf("https://%s.shinyapps.io/%s", rsConnectUser, appName) | |
config <- c(config, sprintf("APP_URL: %s", appUrl)) | |
configFileConn <- file("oauth_config.yml") | |
tryCatch( | |
writeLines(config, configFileConn), | |
finally=close(configFileConn) | |
) | |
rsconnect::setAccountInfo(rsConnectUser, rsConnectToken, rsConnectSecret) | |
rsconnect::deployApp(appName = appName) |