forked from scala-text/scala_text
-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy.sh
executable file
·56 lines (53 loc) · 2.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
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -ex
echo -e "Host github.com\n\tStrictHostKeyChecking no\nIdentityFile ~/.ssh/deploy.key\n" >> ~/.ssh/config &&
openssl aes-256-cbc -k "$SERVER_KEY" -in travis_deploy_key.enc -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 "Kota Mizushima" &&
mv gitbook/_book ../ &&
mv gitbook/scala_text.epub ../_book/scala_text.epub &&
git fetch origin gh-pages:gh-pages &&
git clean -fdx &&
git status &&
git reset . &&
git checkout . &&
git checkout gh-pages &&
rm -rf ./* &&
echo -e "*class\ntarget" > .gitignore &&
cp -r ../_book/* ./ &&
git add . &&
git commit -a -m "auto commit on travis $TRAVIS_JOB_NUMBER $TRAVIS_COMMIT" &&
if [[ "${TRAVIS_BRANCH}" == "master" && "${TRAVIS_EVENT_TYPE}" == "push" && "${TRAVIS_REPO_SLUG}" == "dwango/scala_text" ]];
then git push [email protected]:dwango/scala_text.git gh-pages:gh-pages ; fi
git checkout -qf $TRAVIS_COMMIT
openssl aes-256-cbc -k "$PREVIEW_KEY" -in preview_key.enc -d -a -out preview.key
cp preview.key ~/.ssh/
chmod 600 ~/.ssh/preview.key
echo -e "Host github.com\n\tStrictHostKeyChecking no\nIdentityFile ~/.ssh/preview.key\n" > ~/.ssh/config
git clone [email protected]:dwango/scala_text_previews.git
cd scala_text_previews
rm -rf ./${TRAVIS_BRANCH}
mkdir -p ${TRAVIS_BRANCH}
cp -r ../../_book/* ./${TRAVIS_BRANCH}/
git add .
git commit -a -m "auto commit on travis $TRAVIS_JOB_NUMBER $TRAVIS_COMMIT $TRAVIS_BRANCH"
git push origin gh-pages:gh-pages
cd ..
if [[ "${TRAVIS_BRANCH}" == "master" && "${TRAVIS_EVENT_TYPE}" == "push" && "${TRAVIS_REPO_SLUG}" == "dwango/scala_text" ]]; then
git checkout -qf $TRAVIS_COMMIT
openssl aes-256-cbc -k "$PDF_KEY" -in travis_deploy_pdf_key.enc -d -a -out pdf.key
cp pdf.key ~/.ssh/
chmod 600 ~/.ssh/pdf.key
echo -e "Host github.com\n\tStrictHostKeyChecking no\nIdentityFile ~/.ssh/pdf.key\n" > ~/.ssh/config
git clone [email protected]:dwango/scala_text_pdf.git
cd scala_text_pdf
git submodule update --init
cd scala_text
git pull origin master
cd ..
git add scala_text
git commit -a -m "auto commit on travis $TRAVIS_JOB_NUMBER $TRAVIS_COMMIT"
git push origin master
fi