quarto #694
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: | |
- master | |
- develop | |
pull_request: | |
branches: | |
- master | |
repository_dispatch: | |
types: [quarto] | |
env: | |
BRANCH: ${{ github.event.client_payload.branch }} | |
GH_USER: 'RRC_GHA' # must be set | |
jobs: | |
quarto: | |
if: github.event.action == 'quarto' || github.event_name == 'push' | |
runs-on: ubuntu-latest | |
# commit book build to RRC repo | |
permissions: | |
contents: write | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Check name of branch from nceas-training | |
run: | | |
echo $BRANCH | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Checkout nceas-training repo from branch | |
uses: actions/checkout@v3 | |
with: | |
repository: NCEAS/nceas-training | |
ref: "${{ env.BRANCH }}" | |
path: nceas-training | |
- uses: Homebrew/actions/setup-homebrew@master | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' # Version range or exact version of a Python version to use, using SemVer's version range syntax | |
- name: System libraries | |
run: | | |
sudo apt update | |
sudo apt-get install -y libjq-dev libudunits2-dev libpoppler-cpp-dev libgdal-dev gdal-bin libproj-dev proj-data proj-bin libgeos-dev librdf0-dev libharfbuzz-dev libfribidi-dev | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Restore R package cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.R_LIBS_USER }}/* | |
key: ${{ runner.os }}-build-R-${{ hashFiles('**/DESCRIPTION') }} | |
- name: Install R dependencies | |
run: | | |
options(repos = c(REPO_NAME = "https://packagemanager.posit.co/cran/__linux__/jammy/latest")) | |
install.packages(c("remotes")) | |
remotes::install_deps() | |
remotes::install_deps(pkgdir="nceas-training/materials") | |
shell: Rscript {0} | |
- name: Install pandoc | |
run: | | |
brew install pandoc | |
- name: Install hugo | |
run: | | |
Rscript -e 'blogdown::install_hugo(version = "0.59.0")' | |
- name: Build blogdown site | |
run: | | |
Rscript -e 'blogdown::build_site()' | |
touch public/.nojekyll | |
cp CNAME public/CNAME | |
- name: Install Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
with: | |
tinytex: true # installs tinytex | |
#- name: Build training materials scalable | |
# run: sh _build_quarto.sh | |
- name: Render Quarto training materials | |
uses: quarto-dev/quarto-actions/render@v2 | |
with: | |
to: html | |
path: nceas-training/materials # build from nceas-training from temp dir | |
- name: Move training materials to public/$BRANCH | |
run: | | |
mkdir -p public/$BRANCH # make dir if none exists | |
echo $(ls public) | |
echo $(ls nceas-training/materials) | |
cp -R 'nceas-training/materials/_book'/* public/$BRANCH/ | |
- name: Commit build | |
run: | | |
git config --global user.name $GH_USER | |
git config --global user.email "[email protected]" | |
git add public/$BRANCH | |
git commit -m "Create automated build" | |
git push | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages # branch the action should deploy to | |
folder: public/ # folder the action should deploy |