Adding website builder #14
Workflow file for this run
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: Website | |
on: | |
push: | |
branches: [main, prod] | |
pull_request: | |
branches: [main, prod] | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: rocker/tidyverse:4.4.1 | |
name: rendering-${{ matrix.files.fn }} | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
strategy: | |
fail-fast: false | |
matrix: | |
files: | |
- {fn: "epiestim_vignette"} | |
- {fn: "EpiLPS_vignette"} | |
- {fn: "EpiNow2_vignette"} | |
- {fn: "RtEstim_vignette"} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install packages | |
run: | | |
install2.r -n4 EpiLPS EpiNow2 lemon ggtext | |
installGithub.r EpiForeSITE/summrt | |
installGithub.r mrc-ide/EpiEstim | |
installGithub.r dajmcdon/rtestim | |
- name: Render the file ${{ matrix.files.fn }} | |
run: Rscript --vanilla -e 'rmarkdown::render("vignettes/${{ matrix.files.fn }}.Rmd", output_format = "rmarkdown::github_document")' | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.files.fn }} | |
path: vignettes/${{ matrix.files.fn }}* | |
collect: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: website/ | |
- name: Upload artifacts | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
name: github-pages | |
path: website/ | |
deploy: | |
# Deploy to the github-pages environment | |
# but not on PRs | |
if: ${{ github.event_name != 'pull_request' }} | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: collect | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
with: | |
artifact_name: github-pages | |
preview: true | |