forked from vlgiitr/academic-kickstart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·44 lines (33 loc) · 973 Bytes
/
deploy.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
#!/bin/sh
# If a command fails then the deploy stops
set -e
# Removing public folder
rm -r public/
git rm -r --cached public
#initiate public folder
git submodule add -f -b master https://github.com/vlgiitr/vlgiitr.github.io.git public
printf "\033[0;32m Deploying updates to GitHub:\033[0m\n"
# pushing changes
git add .
git commit -m "Updated changes $(date)"
git push -u origin master
# Build the project.
hugo -t academic # if using a theme, replace with `hugo -t <YOURTHEME>`
# Go To Public folder
cd public
printf "\033[0;32m Now in /public folder.\033[0m\n"
# Add changes to git.
printf "\033[0;32mChecking out master branch.\033[0m\n"
git checkout master
printf "\033[0;32mStaging changes.\033[0m\n"
git add .
# Commit changes.
printf "\033[0;32mCommitting.\033[0m\n"
msg="rebuilding site $(date)"
if [ -n "$*" ]; then
msg="$*"
fi
git commit -m "$msg"
# Push source and build repos.
printf "\033[0;32mPushing to GitHub.\033[0m\n"
git push origin master