-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sh
executable file
·42 lines (37 loc) · 1.01 KB
/
build.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
cd $(dirname $0)
if [ ! -z "$1" ] ; then
OUTPUT_DIR="$1"
else
OUTPUT_DIR="$(pwd)"
fi
IFS=$'\n'
SHOULD_BUILD=0
for source in *.tex ; do
OUTPUT_FILE="$(basename $source '.tex').pdf"
if [[ ! -f "$OUTPUT_FILE" || `git status -uno | grep "Your branch is behind"` ]] ; then
SHOULD_BUILD=1
fi
done
if [[ ${SHOULD_BUILD} -eq 1 ]]; then
echo "We are behind, building a new release..."
git pull origin master
docker pull deigote/cv
docker run -it --rm -v "$(pwd)":/cv-src -v "$OUTPUT_DIR":/output -w /cv-out deigote/cv bash -c "\
set -e; \
cp /cv-src/*.tex . && \
cp /cv-src/*.png . && \
cp /cv-src/lib/* . && \
IFS=$'\n' && \
for source in *.tex ; do \
echo Building \$source && \
lualatex --interaction=batchmode \"\$source\" &> /dev/null && \
echo Built \$source ; \
done && \
mv *.pdf /output"
curl -X PURGE http://deigote.com/cv &> /dev/null
curl -X PURGE "http://deigote.com/cv/Diego%20Toharia%20-%20CV%20(English).pdf" &> /dev/null
else
echo "Everything is up to date"
fi