-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
60 lines (42 loc) · 995 Bytes
/
deploy.sh
File metadata and controls
60 lines (42 loc) · 995 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
# If a command fails then the deploy stops
set -e
printf "\033[0;32mDeploying updates to GitHub...\033[0m\n"
# Go To Public folder
cd public
# Fetch the new pushed changes
git fetch
# Discard any local changes
git checkout .
# Checkout to master branch
git checkout master
# Reset master to the upstream level
git reset --hard origin/master
# Get back to root folder
cd ..
# Build the project.
hugo # if using a theme, replace with `hugo -t <YOURTHEME>`
# Go To Public folder
cd public
# Add changes to git.
git add .
# Commit changes.
msg="rebuilding site $(date)"
if [ -n "$*" ]; then
msg="$*"
fi
git commit -m "$msg"
# Push source and build repos.
git push origin master
# Go back to project root
cd ..
# Fetch the new pushed changes
git fetch
# Checkout to master branch
git checkout master
# Reset master to the upstream level
git reset --hard origin/master
# Update public submodule
git add public
git commit -m "Update public submodule"
git push origin master