Skip to content

render-deploy

render-deploy #134

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
env:
ALL_CHANGED_FOLDERS: ${{ steps.changed-rmd.outputs.all_changed_files }}"
run: |
export WORKFLOW=true
for folder in ${ALL_CHANGED_FOLDERS}; do
code="${folder#src/}"
./render.sh $code
done
cp ./assets/favicon.ico ./docs/favicon.ico
cp ./assets/index.html ./docs/index.html
- name: Add, Commit & Push
env:
ALL_CHANGED_FOLDERS: ${{ steps.changed-rmd.outputs.all_changed_files }}"
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 checkout remotes/origin/pages -- ./G*
for folder in ${ALL_CHANGED_FOLDERS}; do
code="${folder#src/}"
rm -rf $code
done
git add G*
git add docs
git clean -df
mv docs/* .
rm -r docs
git add .
git commit -m "Automatic: Render docs from ${GITHUB_SHA}"
git branch -M temp-pages pages
git push --force origin pages