forked from Migracode-Barcelona/old-syllabus-contents
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish-book.sh
More file actions
37 lines (31 loc) · 834 Bytes
/
Copy pathpublish-book.sh
File metadata and controls
37 lines (31 loc) · 834 Bytes
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
#!/bin/bash
DATE=$(date +%Y%m%d_%H%M%s)
TRAVIS_BRANCH="$1"
IS_TRAVIS_PR="$2"
if [ "$#" -ne 2 ]; then
echo "Please provide a branch (master, london, scotland)"
exit 1
fi
if [[ $IS_TRAVIS_PR -ne "false" ]]; then
echo "Pushed PR. Stopping"
exit 1
fi
if [[ ! $TRAVIS_BRANCH =~ ^(master|develop)$ ]]; then
echo "Pushed to non-deployable branch. Stopping"
exit 1
fi
if [ $TRAVIS_BRANCH == "master" ];then
REPO_NAME="syllabus"
else
REPO_NAME="syllabus-$TRAVIS_BRANCH"
fi
git clone git@github.com:Migracode-Barcelona/$REPO_NAME.git
cp -a _book/* ./$REPO_NAME
cd $REPO_NAME
rm migrabot-key migrabot-key.enc
git config --global user.email "kabaros+migracode@gmail.com"
git config --global user.name "Migracode bot"
git config --global push.default simple
git add . --all
git commit --allow-empty -m "Rebuild on $DATE"
git push