Merge pull request #270 from ioos/dependabot/github_actions/dot-githu… #58
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: renderbook | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/deploy_bookdown.yml' | |
- 'bio-data-guide/**' | |
workflow_dispatch: | |
jobs: | |
bookdown: | |
name: Render-Book | |
runs-on: macOS-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- uses: r-lib/actions/setup-r@v1 | |
with: | |
r-version: '4.1.1' | |
- uses: r-lib/actions/setup-pandoc@v1 | |
with: | |
pandoc-version: '2.14.1' | |
- name: Install packages | |
run: Rscript -e ' | |
install.packages(c("librarian", "rgdal", "rmarkdown", "vroom", "xfun", "tinytex", "tidync"), type = "binary"); | |
librarian::shelf(bookdown, dm, here, lubridate, rmarkdown, tidyverse, worms); | |
remotes::install_github("iobis/obistools", upgrade="never"); | |
tinytex::install_tinytex()' | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
- name: Move headers one level down in edna example | |
run: | | |
sed -i'' -e 's/# /## /g' datasets/dataset-edna/README.md | |
- name: Render Html Book | |
run: Rscript -e ' | |
setwd("bio-data-guide/"); | |
options(knitr.duplicate.label = "allow"); | |
bookdown::render_book("index.Rmd");' | |
- name: Render epub book | |
run: Rscript -e ' | |
setwd("bio-data-guide/"); | |
options(knitr.duplicate.label = "allow"); | |
bookdown::render_book("index.Rmd", "bookdown::epub_book")' | |
- name: remove binder image line from edna example for pdf | |
run: | | |
sed -i'' -e '/Binder/d' datasets/dataset-edna/README.md; | |
sed -i'' -e 's,!\[\](https://contrib.rocks/image?repo=ioos/bio_data_guide),,g' bio-data-guide/index.Rmd | |
- name: Render pdf book | |
run: Rscript -e ' | |
setwd("bio-data-guide/"); | |
options(knitr.duplicate.label = "allow"); | |
bookdown::render_book("index.Rmd", "bookdown::pdf_book")' | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: _book | |
path: 'bio-data-guide/docs' # see _bookdown.yml: output_dir | |
# 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@master | |
- name: Download artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
# Artifact name | |
name: _book # optional | |
# Destination path | |
path: 'bio-data-guide/docs' # see _bookdown.yml: output_dir | |
- name: Deploy to GitHub Pages | |
uses: Cecilapp/GitHub-Pages-deploy@v3 | |
with: | |
build_dir: 'bio-data-guide/docs' # see _bookdown.yml: output_dir | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |