forked from xapi-project/xen-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·39 lines (29 loc) · 1.21 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
#!/bin/bash
# Make sure we're not echoing any sensitive data
set +x
set -o errexit -o nounset
if [ "$TRAVIS_BRANCH" != "master" ]
then
echo "This commit was made against the $TRAVIS_BRANCH and not the master! No deploy!"
exit 0
fi
# Error out if $GH_TOKEN is empty or unset
: ${GH_TOKEN:?"GH_TOKEN needs to be uploaded via travis-encrypt"}
# Print a hash of the token for debugging
echo Token MD5: $(echo $GH_TOKEN | md5sum)
rev=$(git rev-parse --short HEAD)
# Copy data we're interested in out of the container
docker cp ${CONTAINER_NAME}:/home/builder/xen-api/xenapi.json $HOME/
docker cp ${CONTAINER_NAME}:/home/builder/xen-api/release_info.json $HOME/
# Go to home and setup git
cd $HOME
git config --global user.email "[email protected]"
git config --global user.name "Travis"
# Using token clone xapi-project.github.io.git
git clone "https://[email protected]/xapi-project/xapi-project.github.io.git" 2>&1 | sed -e "s/$GH_TOKEN/!REDACTED!/g"
# Copy data we're interested in into the right place
cd xapi-project.github.io
cp -f $HOME/xenapi.json _data/
cp -f $HOME/release_info.json _data/
git commit -am "Updated XenAPI docs based on xen-api/${rev}"
git push origin master 2>&1 | sed -e "s/$GH_TOKEN/!REDACTED!/g"