-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
37 lines (29 loc) · 1.17 KB
/
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
#!/usr/bin/env bash
# This script allows you to easily and quickly generate and deploy your website
# using Hugo to your personal GitHub Pages repository. This script requires a
# certain configuration, run the `setup.sh` script to configure this. See
# https://hjdskes.github.io/blog/deploying-hugo-on-personal-github-pages/index.html
# for more information.
# Set the English locale for the `date` command.
export LC_TIME=en_US.UTF-8
# GitHub username.
USERNAME=lumenated
# Name of the branch containing the Hugo source files.
SOURCE=develop
# The commit message.
MESSAGE="Site rebuild $(date)"
msg() {
printf "\033[1;32m :: %s\n\033[0m" "$1"
}
msg "Pulling down the \`master\` branch into \`public\` to help avoid merge conflicts"
git subtree pull --prefix=public \
[email protected]:$USERNAME/$USERNAME.github.io.git master -m "Merge master"
msg "Building the website"
hugo --theme allegiant
msg "Pushing the updated \`public\` folder to the \`$SOURCE\` branch"
git add public
git commit -m "$MESSAGE"
git push origin "$SOURCE"
msg "Pushing the updated \`public\` folder to the \`master\` branch"
git subtree push --prefix=public \
[email protected]:$USERNAME/$USERNAME.github.io.git master