-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·32 lines (30 loc) · 1.15 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
#!/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.
# Credit and reference: https://hjdskes.github.io/blog/deploying-hugo-on-personal-github-pages/index.html
# Set the English locale for the `date` command.
export LC_TIME=en_US.UTF-8
# GitHub username
USERNAME=likarajo
# GitHub branch containing the Hugo source files
SOURCE=sources
# GitHub repository
REPO=Projects
# 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 \
https://github.com/$USERNAME/$REPO.git origin master -m "Merge origin master"
msg "Building the website"
hugo
msg "Pushing all the updates to the \`$SOURCE\` branch"
git add .
git commit -m "$MESSAGE"
git push origin "$SOURCE"
msg "Pushing the updated \`public\` folder to the \`master\` branch"
git subtree push --prefix=public \
https://github.com/$USERNAME/$REPO.git master