/
docs.sh
executable file
·52 lines (40 loc) · 1.33 KB
/
docs.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
#!/bin/bash
set -o errexit
shopt -s globstar
cargo doc --no-deps
REPO=`git config remote.origin.url`
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
SHA=`git rev-parse --verify HEAD`
git clone --branch gh-pages $REPO deploy_docs
cd deploy_docs
git config user.name "Julius de Bruijn"
git config user.email "julius.debruijn@360dialog.com"
if [ "$TRAVIS_TAG" = "" ]; then
rm -rf master
mv ../target/doc ./master
echo "<meta http-equiv=refresh content=0;url=a2/index.html>" > ./master/index.html
else
rm -rf $TRAVIS_TAG
mv ../target/doc ./$TRAVIS_TAG
echo "<meta http-equiv=refresh content=0;url=a2/index.html>" > ./$TRAVIS_TAG/index.html
latest=$(echo * | tr " " "\n" | sort -V -r | head -n1)
if [ "$TRAVIS_TAG" = "$latest" ]; then
echo "<meta http-equiv=refresh content=0;url=$latest/a2/index.html>" > index.html
fi
fi
git add -A .
git commit -m "rebuild pages at ${TRAVIS_COMMIT}"
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in ../a2_travis.enc -out a2_travis -d
chmod 600 a2_travis
eval `ssh-agent -s`
ssh-add a2_travis
echo
echo "Pushing docs..."
git push $SSH_REPO gh-pages
echo
echo "Docs published."
echo