Skip to content

render-deploy

render-deploy #128

name: Render to HTML & Deploy
on:
repository_dispatch:
types: [render-deploy]
jobs:
check-changes:
name: Check if Rmd or image files changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Find directories with changed rmd or image files
id: changed-files-dir-names
uses: tj-actions/changed-files@v41
with:
files: |
src/G*/*.{rmd,Rmd}
src/G*/img/*.{png,gif}
src/G*/img/*/*.{png,gif}
dir_names: "true"
dir_names_max_depth: 2
- name: Render modified courses to HTML and move output to docs
run: |
folder_list="${{ steps.changed-files-dir-names.outputs.all_changed_files }}"
IFS=" "
read -ra folders <<< "$folder_list"
export WORKFLOW=true
for folder in "${folders[@]}"; do
code="${folder#src/}"
./render.sh $code
done
- name: Add, Commit & Push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout --orphan temp-pages
git rm -r --cached .
git add docs
git clean -df
mv docs/* .
rm -r docs
git checkout pages -- .
git add .
git commit -m "Automatic: Render docs from ${GITHUB_SHA}"
git branch -M temp-pages pages
git push --force origin pages