Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added changes to workflow #1

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 49 additions & 55 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ on:
- master
- develop

tags:
- '*'

pull_request:

merge_group:

jobs:
bookdown:
runs-on: ubuntu-latest
Expand All @@ -23,51 +16,52 @@ jobs:
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
- name: Checkout source code
uses: actions/checkout@v3

- name: Install rmarkdown
run: |
Rscript -e 'install.packages(c("rmarkdown","bookdown"))'

- name: Copy extfiles
run: |
mkdir -p book_source/extfiles
cp -f documentation/tutorials/01_Demo_Basic_Run/extfiles/* book_source/extfiles

- name: Build needed modules
run: |
R CMD INSTALL base/logger
R CMD INSTALL base/remote
R CMD INSTALL base/utils

- name: Render Book
run: |
cd book_source
Rscript -e 'options(bookdown.render.file_scope=FALSE); bookdown::render_book("index.Rmd", "bookdown::gitbook")'

- name: Save artifact
uses: actions/upload-artifact@v3
with:
name: pecan-documentation
path: book_source/_book/

- name: Checkout documentation repo
if: github.event_name == 'push' && github.ref_type == 'branch'
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/pecan-documentation
path: pecan-documentation
token: ${{ secrets.GH_PAT }}

- name: Publish to GitHub
if: github.event_name == 'push' && github.ref_type == 'branch'
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
Loading