forked from inakianduaga/showcar-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
travis_docs.sh
39 lines (29 loc) · 879 Bytes
/
travis_docs.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
#!/bin/bash
set -ev
chmod 600 release_key
eval `ssh-agent -s`
ssh-add release_key
DOCS_BRANCH=gh-pages
mkdir temp-gh-pages
cd temp-gh-pages
USER_NAME="$(git log -1 --pretty=format:'%an')"
USER_EMAIL="$(git log -1 --pretty=format:'%ae')"
COMMIT_MESSAGE="$(git log -1 --pretty=%B --oneline)"
git clone -b $DOCS_BRANCH --single-branch "[email protected]:AutoScout24/showcar-ui.git" .
git config user.name "$USER_NAME"
git config user.email "$USER_EMAIL"
git config push.default simple
#remove all files except all inside .git "shopt -s extglob" extends bash
shopt -s extglob
rm -rf ./!(.git*|.|..)
cp -r ../docs/* .
mkdir -p docs/assets/
mv assets/ docs/
cp -r ../dist .
git add . -A
#checking for files to commit, if exists then commit. If not go further.
if [ -n "$(git status --porcelain)" ]; then
git commit -am "$COMMIT_MESSAGE"
git push origin $DOCS_BRANCH
fi
cd ..