Docs: Adding a note in run_pecan.qmd about installation of PEcAn.SIPNET package #770
Workflow file for this run
This file contains hidden or 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: Render Demo Notebooks | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| tags: | |
| - '*' | |
| pull_request: | |
| merge_group: | |
| workflow_dispatch: | |
| jobs: | |
| render-notebook: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build PEcAn base Docker image | |
| run: | | |
| docker build -t pecan-base-ci:latest -f docker/base/Dockerfile . | |
| - name: Set up Quarto | |
| uses: quarto-dev/quarto-actions/setup@v2 | |
| with: | |
| version: '1.8.17' | |
| - name: Check R code style with styler | |
| run: | | |
| docker run --rm -v ${{ github.workspace }}:/work pecan-base-ci:latest bash -c "Rscript -e ' | |
| if (!requireNamespace(\"styler\", quietly = TRUE)) install.packages(\"styler\"); | |
| files_to_check <- c( | |
| \"/work/documentation/tutorials/Demo_1_Basic_Run/run_pecan.qmd\", | |
| \"/work/documentation/tutorials/Demo_02_Uncertainty_Analysis/uncertainty.qmd\" | |
| ); | |
| unstyled <- styler::style_file(files_to_check); | |
| if (is.data.frame(unstyled) && \"changed\" %in% names(unstyled) && any(unstyled\$changed == TRUE)) { | |
| print(unstyled[unstyled\$changed, ]); | |
| stop(\"One or more .qmd files are not styled. Please run styler::style_file() locally and commit the changes.\"); | |
| } else { | |
| cat(\"All checked .qmd files are styled.\\n\"); | |
| } | |
| '" | |
| - name: Render Quarto notebooks to HTML | |
| run: | | |
| docker run --rm -v ${{ github.workspace }}:/work pecan-base-ci:latest bash -c " | |
| quarto render /work/documentation/tutorials/Demo_1_Basic_Run/run_pecan.qmd --to html && | |
| quarto render /work/documentation/tutorials/Demo_02_Uncertainty_Analysis/uncertainty.qmd --to html | |
| " | |
| - name: Prepare HTML artifacts | |
| run: | | |
| mkdir quarto_html_build | |
| cp documentation/tutorials/Demo_1_Basic_Run/run_pecan.html quarto_html_build/ | |
| cp -r documentation/tutorials/Demo_1_Basic_Run/run_pecan_files quarto_html_build/ | |
| cp documentation/tutorials/Demo_02_Uncertainty_Analysis/uncertainty.html quarto_html_build/ | |
| cp -r documentation/tutorials/Demo_02_Uncertainty_Analysis/uncertainty_files quarto_html_build/ | |
| - name: Upload rendered HTML as artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: quarto-html | |
| path: quarto_html_build/ | |
| retention-days: 5 | |
| - name: Check if documentation repo exists | |
| id: doc_exists | |
| run: | | |
| if git ls-remote https://github.com/${{ github.repository_owner }}/pecan-documentation.git > /dev/null 2>&1; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Checkout documentation repo | |
| if: ${{ github.event_name == 'push' && steps.doc_exists.outputs.exists == 'true' }} | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ github.repository_owner }}/pecan-documentation | |
| path: pecan-documentation | |
| token: ${{ secrets.GH_PAT }} | |
| - name: Deploy HTML to documentation repo | |
| if: ${{ github.event_name == 'push' && steps.doc_exists.outputs.exists == 'true' }} | |
| run: | | |
| git config --global user.email "pecanproj@gmail.com" | |
| git config --global user.name "GitHub Documentation Robot" | |
| # Determine version/branch | |
| export VERSION=$(echo $GITHUB_REF | sed 's,.*/,,' ) | |
| if [ "$VERSION" = "main" ]; then | |
| export VERSION=latest | |
| fi | |
| # Create target directory | |
| TARGET_DIR="pecan-documentation/${VERSION}/rendered-demo-notebooks" | |
| mkdir -p $TARGET_DIR | |
| # Copy HTML files and support folders | |
| rsync -a --delete quarto_html_build/* $TARGET_DIR/ | |
| echo "Autogenerated by https://github.com/PecanProject/pecan/actions/workflows/render-quarto.yml" > "$TARGET_DIR"/README.txt | |
| # Commit and push | |
| cd pecan-documentation | |
| git add --all * | |
| git commit -m "Update Quarto HTML from pecan revision ${GITHUB_SHA}" || true | |
| git push -q origin main |