-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·44 lines (32 loc) · 1.16 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
#!/bin/bash
# Exit with nonzero exit code if anything fails
set -e
# check current branch
if [ 'master' != $TRAVIS_BRANCH ]; then
echo "Deploy only on master branch. Current branch: '$branch'.";
exit 0;
fi
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
echo -e "\033[0;32mGo To Public folder...\033[0m"
rm -rf public
mkdir -p public
pushd public
echo -e "\033[0;32mUpdating static site content...\033[0m"
git clone [email protected]:aliaksei-lithium/aliaksei-lithium.github.io.git .
git config user.email "[email protected]"
git config user.name "Aliaksei Zhynhiarouski"
git remote set-url origin [email protected]:aliaksei-lithium/aliaksei-lithium.github.io.git
echo -e "\033[0;32mReturning...\033[0m"
popd
echo -e "\033[0;32mBuild the project...\033[0m"
hugo -t detox
echo -e "\033[0;32mGo To Public folder...\033[0m"
pushd public
echo -e "\033[0;32mAdd changes to index...\033[0m"
git add .
echo -e "\033[0;32mCommiting changes...\033[0m"
git diff-index --quiet HEAD || git commit -m "rebuilding site `date`"
echo -e "\033[0;32mPush source and build repos...\033[0m"
git push origin master
echo -e "\033[0;32mReturning...\033[0m"
popd