-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
upload_script.sh
executable file
·55 lines (43 loc) · 1.04 KB
/
upload_script.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
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/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"
# Build the project.
#hugo --gc
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
# 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