Section 9 Bookdown Tutorial (Create-this-page)

9.1 Video Tutorial (in 10 mins)

I followed this YouTube video to create this page: https://www.youtube.com/watch?v=RdSmYvbQkhs

9.2 GitHub action

In order to automatically generate this bookdown page, we need to setup a github action.

Please find this below :)

on:
  push:
     branches:
       - main

name: renderbook

jobs:
  bookdown:
    name: bookdown setup
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: r-lib/actions/setup-r@v1
      - uses: r-lib/actions/setup-pandoc@v1
      - name: Install rmarkdown
        run: Rscript -e 'install.packages(c("rmarkdown","bookdown"))'
      - name: Render Book
        run: Rscript setup.R
        # run: Rscript -e 'bookdown::render_book("index.Rmd")'
  
      - name: pull-request
        uses: repo-sync/pull-request@v2
        with:
          destination_branch: "main"
          github_token: ${{ secrets.GITHUB_TOKEN }}
          
      - name: commit
        run: |
          git config --global user.email jh2259@mrc-cu.cam.ac.uk
          git config --global user.name xihajun
          git add .
          git commit -m "automation bookdown" -a
        
      - name: Push changes
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}