-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
executable file
·66 lines (51 loc) · 1.97 KB
/
publish.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
set -e
mkdir -p ~/.ssh
echo running ssh-keyscan to add github.com to known hosts
ssh-keyscan github.com >> ~/.ssh/known_hosts
pub_script_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
echo $pub_script_root
pushd $pub_script_root
curl -s https://api.github.com/repos/netfoundry/ziti-ci/releases/latest \
| grep browser_download_url \
| cut -d ":" -f2,3 \
| tr -d \" \
| wget -i - -O ziti-ci
chmod +x ziti-ci
mv ziti-ci /usr/bin
if [ "${GIT_BRANCH}" == "master" ]
then
echo on master branch - publish can proceed
./gendoc.sh docs
ziti-ci configure-git
git add docs docfx_project/ziti-*
#move back to master once we're this deep into the run
if [[ "$(git config --get remote.origin.url | cut -b1-3)" == "htt" ]]; then
echo changing git repo from https to git so that we can push...
./changeToSsh.sh
fi
git checkout master
# branch protection disallows this git diff-index --quiet HEAD || git commit -m "[ci skip] publish docs from travis" && git push
echo "cloning actual github pages now to push docs into"
git clone https://github.com/openziti/openziti.github.io.git
# git clone [email protected]:openziti/openziti.github.io.git
# clean the old site to remove any pages/etc that are no longer around
rm -r openziti.github.io/*
# copy all the docs into the publish site
cp -r docs/* openziti.github.io/
cd openziti.github.io
git add *
if [[ "$(git config --get remote.origin.url | cut -b1-3)" == "htt" ]]; then
echo changing git repo from https to git so that we can push...
../changeToSsh.sh
fi
echo Configuring git
git config user.name ziti-ci
git config user.email [email protected]
git config core.sshCommand "ssh -i /ziti-doc/github_deploy_key"
git diff-index --quiet HEAD || git commit -m "[ci skip] publish docs from travis" && git push
else
echo ========= cannot publish from branch that is not master : ${GIT_BRANCH}
echo ========= publish considered successful though no op
fi
popd