-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·45 lines (38 loc) · 867 Bytes
/
deploy.sh
File metadata and controls
executable file
·45 lines (38 loc) · 867 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
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
set -x
set -e
set -o pipefail
URL=$1
BRANCH=$2
DEPLOY_CONFIG=$3
BUNDLE=$4
DRAFTS=$5
SRC=$(pwd)
TEMP=$(mktemp -d -t jgd-XXX)
trap "rm -rf ${TEMP}" EXIT
echo -e "\nBuilding Jekyll site:"
rm -rf _site
if [ -r ${DEPLOY_CONFIG} ]; then
${BUNDLE} jekyll build --config _config.yml,${DEPLOY_CONFIG} ${DRAFTS}
else
${BUNDLE} jekyll build ${DRAFTS}
fi
if [ ! -e _site ]; then
echo -e "\nJekyll didn't generate anything in _site!"
exit -1
fi
cp -R _site ${TEMP}
CLONE=${TEMP}/clone
echo -e "Cloning Github repository:"
git clone -b "${BRANCH}" "${URL}" "${CLONE}"
cd ${CLONE}
echo -e "\nDeploying into ${BRANCH} branch:"
rm -rf *
cp -R ${TEMP}/_site/* .
rm -f README.md
git add .
git commit -am "new version $(date)" --allow-empty
git push origin ${BRANCH} 2>&1 | sed 's|'$URL'|[skipped]|g'
echo -e "\nCleaning up:"
rm -rf "${CLONE}"
rm -rf "${SITE}"