Skip to content

Integration Testing for do_conversions workflow #4797

Integration Testing for do_conversions workflow

Integration Testing for do_conversions workflow #4797

Workflow file for this run

name: renderbook
on:
push:
branches:
- main
- develop
tags:
- '*'
pull_request:
merge_group:
workflow_dispatch:
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@v4
# install bookdown
- name: Install bookdown
run: |
Rscript \
-e 'repos <- c(getOption("repos"), sub(r"(\d{4}-\d{2}-\d{2})", "latest", getOption("repos")))' \
-e 'remotes::install_version("bookdown", ">= 0.31", dependencies = TRUE, upgrade = FALSE, repos = repos)'
# 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 == 'push'
uses: actions/checkout@v4
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 == 'push'
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Documentation Robot"
export VERSION=$(echo $GITHUB_REF | sed 's,.*/,,' )
if [ "$VERSION" = "main" ]; then
export VERSION=latest
fi
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 main