update project #30
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
on: | |
push: | |
branches: | |
- main | |
name: renderbook | |
jobs: | |
bookdown: | |
name: Render-Book | |
runs-on: macOS-latest | |
steps: | |
- uses: actions/checkout@v3 # was v1 before | |
- uses: r-lib/actions/setup-r@v2 # was v1 before | |
- uses: r-lib/actions/setup-pandoc@v2 # was v1 before | |
- name: Install rmarkdown | |
run: Rscript -e 'install.packages(c("rmarkdown","bookdown","tidyverse","kableExtra","stringr"))' | |
- name: Render Book | |
run: Rscript -e 'bookdown::render_book("index.Rmd")' | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: outputs | |
path: outputs/ | |
# Need to first create an empty gh-pages branch | |
# see https://pkgdown.r-lib.org/reference/deploy_site_github.html | |
# and also add secrets for a GH_PAT and EMAIL to the repository | |
# gh-action from Cecilapp/GitHub-Pages-deploy | |
checkout-and-deploy: | |
runs-on: ubuntu-latest | |
needs: bookdown | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download artifact | |
uses: actions/download-artifact@v1.0.0 | |
with: | |
# Artifact name | |
name: outputs # optional | |
# Destination path | |
path: outputs # optional | |
- name: Deploy to GitHub Pages | |
uses: Cecilapp/GitHub-Pages-deploy@v2 | |
env: | |
EMAIL: ${{ secrets.EMAIL }} # must be a verified email | |
GH_TOKEN: ${{ secrets.GH_PAT }} # https://github.com/settings/tokens | |
BUILD_DIR: outputs/ # "_site/" by default | |