Skip to content

Build and Deploy RMarkdown Website #315

Build and Deploy RMarkdown Website

Build and Deploy RMarkdown Website #315

name: Build and Deploy RMarkdown Website
on:
workflow_dispatch:
push:
branches: main
pull_request:
branches: main
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.FORECASTHUB_TOKEN }}
workflow: reports-country.yml
name: country-reports
path: reports
repo: covid19-forecast-hub-europe/covid19-forecast-hub-europe
- uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.FORECASTHUB_TOKEN }}
workflow: reports-model.yml
name: model-reports
path: reports
repo: covid19-forecast-hub-europe/covid19-forecast-hub-europe
- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-r@v1
with:
install-r: false
use-public-rspm: true
- name: Install R system requirements
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev
- name: Install R dependencies
run: |
install.packages(c("remotes", "rmarkdown"))
remotes::install_deps(dependencies = TRUE)
shell: Rscript {0}
- name: Render Site
run: Rscript -e "rmarkdown::render_site(encoding = 'UTF-8')"
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./_site
# Deployment job
deploy:
if: github.event_name != 'pull_request'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1