-
Notifications
You must be signed in to change notification settings - Fork 8
/
github_pages_deploy.sh
executable file
·45 lines (36 loc) · 1.26 KB
/
github_pages_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
#!/bin/bash
#
# Deploy the PDF, HTML, EPUB files of an Underscore book (source)
# into another Git repository (target)
#
set -e
if [[ "${TRAVIS_PULL_REQUEST}" == "false" &&
"${TRAVIS_BRANCH}" == "3.3"
]]; then
# Configuration
# 1. The key for writing into the other repository:
export KEY_FILENAME=essential_slick_deploy.enc
# 2. Folder inside target of where to place the artifacts:
export TARGET_PATH=books/essential-slick/
# End of configuration
echo "Starting deploy to github pages"
echo -e "Host github.com\n\tStrictHostKeyChecking no\nIdentityFile ~/.ssh/deploy.key\n" >> ~/.ssh/config
openssl aes-256-cbc -k "$SERVER_KEY" -in $KEY_FILENAME -d -a -out deploy.key
cp deploy.key ~/.ssh/
chmod 600 ~/.ssh/deploy.key
git config --global user.email "[email protected]"
git config --global user.name "Travis Build"
export SRC_DIR=`pwd` # e.g., /home/travis/build/underscoreio/essential-slick
export TARGET_DIR=/tmp/dist
mkdir $TARGET_DIR
cd $TARGET_DIR
git clone [email protected]:underscoreio/books.git
cd $TARGET_PATH
cp $SRC_DIR/dist/*.pdf .
cp $SRC_DIR/dist/*.html .
cp $SRC_DIR/dist/*.epub .
git add .
git commit -m "auto commit via travis $TRAVIS_JOB_NUMBER $TRAVIS_COMMIT [ci skip]"
git push [email protected]:underscoreio/books.git master:master
rm -rf $TARGET_DIR
fi