-
Notifications
You must be signed in to change notification settings - Fork 22
/
automated
executable file
·43 lines (31 loc) · 867 Bytes
/
automated
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
#!/bin/bash
# Automated deploy script with Circle CI.
# Exit if any subcommand fails.
set -e
# Variables
ORIGIN_URL=`git config --get remote.origin.url`
echo "Started deploying"
# Checkout gh-pages branch.
if [ `git branch | grep gh-pages` ]
then
git branch -D gh-pages
fi
git checkout -b gh-pages
# Build site.
yarn install --modules-folder ./_assets/yarn
bundle exec jekyll build
# Delete and move files.
find . -maxdepth 1 ! -name '_site' ! -name '.git' ! -name '.gitignore' -exec rm -rf {} \;
mv _site/* .
rm -R _site/
# Push to gh-pages.
git config user.name "$USER_NAME"
git config user.email "$USER_EMAIL"
git add -fA
git commit --allow-empty -m "$(git log -1 --pretty=%B) [ci skip]"
git push -f $ORIGIN_URL gh-pages
# Move back to previous branch.
git checkout -
yarn install --modules-folder ./_assets/yarn
echo "Deployed Successfully!"
exit 0