forked from bvciitk/ecell-iitk.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis_deploy.sh
46 lines (42 loc) · 1.34 KB
/
.travis_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
#!/bin/bash
# Common Variables ------------------------------------------>
# Target Variables
TARGET_REPO_SLUG=ECell-IITK/ecell-production
TARGET_BRANCH=master
TARGET_BASE_DIRECTORY="."
BUILD_TAG=ECELLMASTER
# Directories not to clean up
KEEP_DIRECTORIES=(esummit tedx sip ca CNAME)
#------------------------------------------------------------>
CURRENT_REPO_PATH=$PWD
echo $PWD
# rm -rf .git .gitignore
pushd $HOME
git clone --branch=$TARGET_BRANCH https://[email protected]/$TARGET_REPO_SLUG target
cd target
TARGET_GIT_HEAD=$PWD
eval mkdir -p $TARGET_BASE_DIRECTORY
eval cd $TARGET_BASE_DIRECTORY
# Makes command that will be executed (to clean old files)
COMMAND="find . -maxdepth 1 ! ( -name . -o -name .. -o -name .git -o -name .gitignore"
for DIRECTORY in "${KEEP_DIRECTORIES[@]}"; do
COMMAND+=" -o -name "$DIRECTORY
done
COMMAND+=" )"
FINAL_COMMAND=$COMMAND" -exec rm -rf {} ;"
echo "Executing command: "$FINAL_COMMAND
echo "Deleting files:"
$COMMAND
$FINAL_COMMAND
# v1 (on Esummit repo it caused problems)
# cp -rv $CURRENT_REPO_PATH/* .
rsync -av $CURRENT_REPO_PATH/* . --exclude .git
ls -alh
# At this time everything is updated
eval cd $TARGET_GIT_HEAD
git add -A
git config user.name "Bot-Ecell"
git config user.email "[email protected]"
git commit -m "Bot Build ID: "$BUILD_TAG$TRAVIS_BUILD_NUMBER
git push origin $TARGET_BRANCH
popd