Skip to content

Merge pull request #3205 from RohanSasne/patch-1 #3161

Merge pull request #3205 from RohanSasne/patch-1

Merge pull request #3205 from RohanSasne/patch-1 #3161

Workflow file for this run

name: renderbook
on:
push:
branches:
- master
- develop
tags:
- '*'
pull_request:
merge_group:
jobs:
bookdown:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
container:
image: pecan/depends:R4.1
steps:
# checkout source code
- uses: actions/checkout@v3
# install rmarkdown
- name: Install rmarkdown
run: |
Rscript -e 'install.packages(c("rmarkdown","bookdown"))'
# copy files
- name: copy extfiles
run: |
mkdir -p book_source/extfiles
cp -f documentation/tutorials/01_Demo_Basic_Run/extfiles/* book_source/extfiles
# compile PEcAn code
- name: build needed modules
run: |
R CMD INSTALL base/logger
R CMD INSTALL base/remote
R CMD INSTALL base/utils
# render book
- name: Render Book
run: |
cd book_source
Rscript -e 'options(bookdown.render.file_scope=FALSE); bookdown::render_book("index.Rmd", "bookdown::gitbook")'
# save artifact
- uses: actions/upload-artifact@v3
with:
name: pecan-documentation
path: book_source/_book/
# download documentation repo
- name: Checkout documentation repo
if: github.event_name != 'pull_request'
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/pecan-documentation
path: pecan-documentation
token: ${{ secrets.GH_PAT }}
# upload new documentation
- name: publish to github
if: github.event_name != 'pull_request'
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Documentation Robot"
export VERSION=${GITHUB_REF##*/}
cd pecan-documentation
mkdir -p $VERSION
rsync -a --delete ../book_source/_book/ ${VERSION}/
git add --all *
git commit -m "Build book from pecan revision ${GITHUB_SHA}" || true
git push -q origin master