-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·38 lines (30 loc) · 852 Bytes
/
deploy.sh
File metadata and controls
executable file
·38 lines (30 loc) · 852 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
#!/usr/bin/env bash
# Require a clean working tree, including submodules.
require_clean_working_tree () {
# Update the index
git update-index -q --refresh
if [[ -n $(git status --porcelain --ignore-submodules) ]]
then
echo -e >&2 "\033[0;31mWorking tree is not clean. Quitting...\033[0m"
exit 1
fi
}
## main
require_clean_working_tree
revision=`git rev-parse HEAD`
commit_subject="Rebuild site on `date`"
commit_body="For revision ${revision}"
# Build the site.
hugo --minify
# Add published site changes to git.
cd public
git add .
git commit -m "$commit_subject" -m "$commit_body"
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
git push origin main
# Come back to 'source'.
echo -e "Updating source repo..."
cd ..
git add .
git commit -m "$commit_subject" -m "$commit_body"
git push origin main