forked from rherrmann/osgi-testsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis-deploy.sh
35 lines (27 loc) · 1.17 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
#!/bin/bash
function error_exit
{
echo -e "\e[01;31m$1\e[00m" 1>&2
exit 1
}
if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
echo -e "Starting to deploy to gh-pages\n"
# create and cd into temporary deployment work directory
mkdir deployment-work
cd deployment-work
# setup git and clone from gh-pages branch
git config --global user.email "travis-deployer@codeaffine.com"
git config --global user.name "Travis Deployer"
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/rherrmann/osgi-testsuite.git . > /dev/null 2>&1 || error_exit "Error cloning gh-pages"
# clean the repository directory, then copy the build result into it
git rm -rf repository
mkdir -p repository
cp -rf ../com.codeaffine.osgi.testsuite.releng/repository/target/repository/* ./repository
# add, commit and push files
git add -f .
git commit -m "[ci skip] Deploy Travis build #$TRAVIS_BUILD_NUMBER to gh-pages"
git push -fq origin gh-pages > /dev/null 2>&1 || error_exit "Error uploading the build result to gh-pages"
# go back to the directory where we started
cd ..
echo -e "Done with deployment to gh-pages\n"
fi