-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathupload_script.sh
More file actions
executable file
·75 lines (59 loc) · 1.54 KB
/
upload_script.sh
File metadata and controls
executable file
·75 lines (59 loc) · 1.54 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
set -e
rm -rf public
git submodule add -f -b master https://github.com/rycolab/rycolab.github.io.git public
printf "\033[0;32mDeploying updates to GitHub...\033[0m\n"
HUGO_BIN=${HUGO_BIN:-}
if [ -z "$HUGO_BIN" ]; then
if [ -x "./hugo" ]; then
HUGO_BIN="./hugo"
else
HUGO_BIN=$(command -v hugo 2>/dev/null || true)
fi
fi
if [ -z "$HUGO_BIN" ]; then
echo "Could not locate a Hugo executable. Set HUGO_BIN to an extended Hugo binary." >&2
exit 1
fi
echo "Using Hugo binary: $HUGO_BIN"
if ! "$HUGO_BIN" version 2>/dev/null | grep -qi "extended"; then
echo "Warning: $HUGO_BIN does not appear to be the extended edition; SCSS assets may fail to build." >&2
fi
# Build the project.
#hugo --gc
SOURCE='.'
DESTINATION=public/
TEMP=`mktemp -d`
echo "Building from $SOURCE"
"$HUGO_BIN" --source="$SOURCE" --destination="$TEMP"
cp "$DESTINATION"/{.git,CNAME} $TEMP
if [ $? -eq 0 ]; then
echo "Syncing to $DESTINATION"
rsync -aq --delete "$TEMP/" "$DESTINATION"
fi
# Go To Public folder
cd public
# Add changes to git.
git add -A
# Commit changes.
msg="rebuilding site $(date)"
if [ -n "$*" ]; then
msg="$*"
fi
git commit -m "$msg"
# Push source and build repos.
git push origin master
cd ..
git add -A
git commit -m "$msg"
git push origin master
# SOURCE='.'
# DESTINATION=public/
# TEMP=`mktemp -d`
# echo "Building from $SOURCE"
# hugo --source="$SOURCE" --destination="$TEMP"
# cp "$DESTINATION"/{.git,CNAME} $TEMP
# if [ $? -eq 0 ]; then
# echo "Syncing to $DESTINATION"
# rsync -aq --delete "$TEMP/" "$DESTINATION"
# fi