-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (67 loc) · 2.21 KB
/
render-deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Render to HTML & Deploy
on:
push:
branches:
- main
paths:
- src/G*/*
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@v44
with:
files: |
src/G*/*.{rmd,Rmd}
src/G*/img/*.{png,gif}
src/G*/img/*/*.{png,gif}
dir_names: "true"
dir_names_max_depth: 2
dir_names_deleted_files_include_only_deleted_dirs: "true"
output_renamed_files_as_deleted_and_added: "true"
- name: Render modified courses to HTML and move output to docs
env:
WORKFLOW: true
CHANGED_DIRS: ${{ steps.changed-files-dir-names.outputs.all_changed_files }}
run: |
set -e
for folder in ${CHANGED_DIRS}; do
code="${folder#src/}"
./render.sh $code
done
if [ ! -d "docs" ]; then
mkdir docs
fi
cp ./assets/favicon.ico ./docs/favicon.ico
cp ./assets/index.html ./docs/index.html
- name: Add, Commit & Push
env:
CHANGED_DIRS: ${{ steps.changed-files-dir-names.outputs.all_changed_files }}
DELETED_DIRS: ${{ steps.changed-files-dir-names.outputs.deleted_files }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
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 ${CHANGED_DIRS} ${DELETED_DIRS}; 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