Skip to content

Merge pull request #67 from tidy-survey-r/ch04-author-review-v2 #92

Merge pull request #67 from tidy-survey-r/ch04-author-review-v2

Merge pull request #67 from tidy-survey-r/ch04-author-review-v2 #92

on:
push:
branches:
- main
name: renderbook
jobs:
bookdown:
name: Render-Book
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: True
- uses: r-lib/actions/setup-r@v2
with:
r-version: '4.3.1'
use-public-rspm: true
- uses: r-lib/actions/setup-pandoc@v2
- name: Set RENV_PATHS_ROOT
shell: bash
run: |
echo "RENV_PATHS_ROOT=${{ runner.temp }}/renv" >> $GITHUB_ENV
- name: Cache packages
uses: actions/cache@v3
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Install tidycensus system dependency
shell: bash
run: |
sudo apt-get install libudunits2-dev libgdal-dev libgeos-dev libproj-dev libfontconfig1-dev
- name: Restore packages
shell: Rscript {0}
run: |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv")
renv::restore()
- name: Render Book
env:
CENSUS_KEY: ${{ secrets.CENSUS_KEY }}
OSF_PAT: ${{ secrets.OSF_PAT }}
run: Rscript -e 'bookdown::render_book("index.Rmd")'
- uses: actions/upload-artifact@v1
with:
name: _book
path: _book/
# 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@main
- name: Download artifact
uses: actions/download-artifact@v1.0.0
with:
# Artifact name
name: _book # optional
# Destination path
path: _book # optional
- name: Deploy to GitHub Pages
uses: Cecilapp/GitHub-Pages-deploy@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
email: ${{ secrets.EMAIL }}
build_dir: _book/