-
Notifications
You must be signed in to change notification settings - Fork 3
/
update
executable file
·46 lines (36 loc) · 1.08 KB
/
update
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
#!/bin/sh
set -e
. "$(git --exec-path)/git-sh-setup"
cd_to_toplevel
export GIT_INDEX_FILE="$GIT_DIR/index.github-pages"
rm -f -- "$GIT_INDEX_FILE"
# hugo does not clean up old clutter
rm -rf public
./admin/hugo 1>&2
find content/talks/ -mindepth 2 -maxdepth 2 -name '*.slide' -type f -printf '%h\n' \
| uniq \
| while read p; do
rm -rf temp/represent
mkdir -p temp/represent
cp -r "$p"/* temp/represent
rm -f temp/represent/*.html temp/represent/*.md
./admin/represent -src="temp/represent" -publish="$p"
rm -rf temp/represent
done
if git diff-index --quiet HEAD; then
echo "$(basename "$0"): dirty, not publishing" 1>&2
exit 0
fi
if [ "$(git symbolic-ref HEAD)" != "refs/heads/master" ]; then
echo "$(basename "$0"): not on master, not publishing" 1>&2
exit 0
fi
find public/ -type f -print0 \
| git update-index --add --replace -z --stdin
TREE="$(git write-tree --prefix=public/)"
COMMIT="$(git commit-tree "$TREE" <<EOF
Regenerated site.
EOF
)"
echo git push https://github.com/bazil/bazil.github.io +"$COMMIT":refs/heads/master 1>&2
echo $COMMIT