-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
executable file
·58 lines (42 loc) · 1.46 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -e
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
# Try:
# git submodule add -f -b master https://github.com/mrichman/mrichman.github.io.git public
# $ rm -rf public/
# git submodule add -f -b master https://github.com/mrichman/mrichman.github.io.git public
# 'public' already exists in the index
#
# You have to unstage the rack directory first. Then you can add the submodule:
#
# $ git rm -r public
# $ git submodule add -f -b master https://github.com/mrichman/mrichman.github.io.git public
# Build the project.
# hugo -b https://markrichman.com # if using a theme, replace by `hugo -t <yourtheme>`
hugo -b https://markrichman.com.s3-website-us-east-1.amazonaws.com/
# Minify CSS
# https://www.npmjs.com/package/minifier
#echo -e "\033[0;32mMinifying CSS...\033[0m"
#minify --no-comments --output ./public/css/main.min.css ./public/css/poole.css ./public/css/hyde.css
# Go To Public folder
cd public
# Add changes to git.
echo -e "\033[0;32mCommitting changes to /public via git...\033[0m"
# Windows workaround
#if [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
# # core.safecrlf turns off warning, not the function itself
# git config --global core.safecrlf false
#fi
git add -A
# Commit changes.
msg="rebuilding site `date`"
if [ $# -eq 1 ]
then msg="$1"
fi
git commit -m "$msg"
# Push source and build repos.
git push origin master
# Deploy to S3
aws s3 cp . s3:https://markrichman.com --recursive --acl public-read-write
# Come Back
cd ..