update MainApp.R for serverless version #2
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
name: Publish Shiny App | |
on: | |
push: | |
branches: [main, master] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
# Step 2: Install system dependencies | |
- name: Install system dependencies (libarchive-dev and libcurl4-openssl-dev) | |
run: sudo apt-get update && sudo apt-get install -y libarchive-dev libcurl4-openssl-dev | |
# Step 3: Set up R | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
# Step 4: Install Shinylive | |
# - name: Install Shinylive | |
# run: | | |
# Rscript -e 'install.packages("shinylive", repos = "https://cloud.r-project.org")' | |
- name: "Setup R dependencies" | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
packages: | |
cran::[email protected] | |
any::shiny | |
any::DT | |
any::bslib | |
any::broom | |
any::ggplot2 | |
any::base64enc | |
any::shinyjs | |
any::mgcv | |
any::RColorBrewer | |
any::tidyr | |
any::purrr | |
any::agricolae | |
any::drc | |
any::cowplot | |
any::MASS | |
any::Matrix | |
any::equatiomatic | |
any::openxlsx | |
any::car | |
any::httr | |
any::jose | |
any::openssl | |
# Step 5: Export Shiny app as a static website | |
- name: Export Shiny app | |
run: | | |
Rscript -e 'shinylive::export("./app", "_site")' | |
# Step 6: Upload artifact for deployment | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: _site | |
retention-days: 1 | |
# Step 7: Deploy to GitHub Pages | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v2 | |