-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
34 lines (25 loc) · 866 Bytes
/
build.sh
File metadata and controls
34 lines (25 loc) · 866 Bytes
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
#!/bin/bash
###################
# Build / deploy script
# Meant to be called by devops builder
###################
COMMIT="$COMMIT"
MAIL="$EMAIL"
DEST="$DEST"
# Set defaults
[ -z "$DEST" ] && DEST='gh-pages'
TMP_FOLDER=$(mktemp -d)
echo -n "Running the build process... " >&2
make build
make build
[ $? -eq 0 ] && echo "Success." >&2 || echo "Failed." >&2
echo "Copying build result..." >&2
cp -a _site/* $TMP_FOLDER
echo "Resetting git repository and swithing branch..." >&2
git reset --hard && git checkout $DEST
echo "Emptying destination branch, and populating with new build..." >&2
git rm -r --ignore-unmatch * && cp -a $TMP_FOLDER/* .
echo "Adding new build and pushing result to GitHub" >&2
git add . && git commit -am "Build triggered by commit $COMMIT from $EMAIL" && git push origin $DEST
echo "Removing build folder..." >&2
rm -rf $TMP_FOLDER