-
Notifications
You must be signed in to change notification settings - Fork 18
/
deploy.sh
executable file
·42 lines (34 loc) · 896 Bytes
/
deploy.sh
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
#! /bin/bash
set -e
set -u
# Deploy generated html pages to github.io.
BUILD=./build/
HTML=$BUILD/html
DIR=$BUILD/jfbastien.github.io
PAPERS=$DIR/papers
[email protected]:jfbastien/jfbastien.github.io.git
HASH=$(git rev-parse HEAD)
SUBJECT=$(git log -n1 --pretty=format:%s)
# Hacky reuse of git's require_clean_work_tree.
OPTIONS_SPEC=
LONG_USAGE=
USAGE=
NONGIT_OK=
SUBDIRECTORY_OK=
source $(git --exec-path)/git-sh-setup ""
require_clean_work_tree deploy "Please commit or stash changes."
# Copy generated html files to the github.io repo.
rm -rf $DIR
mkdir $DIR
git clone $CLONE $DIR
find $HTML/*.html -maxdepth 1 -type f \
\( -iname "*.html" ! -iname "genindex.html" ! -iname "search.html" \) | \
xargs -I{} cp {} $PAPERS/
# Commit the changes, and deploy them.
pushd $PAPERS
git status
git add "*.html"
git commit -m "Update '$SUBJECT'
Hash: $HASH"
git push origin master
popd