-
Notifications
You must be signed in to change notification settings - Fork 3
/
publish-javadoc.sh
executable file
·58 lines (46 loc) · 1.55 KB
/
publish-javadoc.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
#!/bin/bash
#version: 2016-08-31
repo=braille-utils.pef-tools
version=`grep 'version=' gradle.properties | grep -E -o '[0-9\.]+.+$'`
if [[ $version == *SNAPSHOT ]]; then
is_release=false
else
is_release=true
fi
if [ `git diff --name-only HEAD HEAD~ | grep gradle.properties -c` = 1 ]; then
prop_change="true"
else
prop_change="false"
fi
echo "Version: $version"
echo "Is release: $is_release"
echo "Properties changed: $prop_change"
if [ "$prop_change" = "false" ]; then
if [ "$is_release" = "true" ]; then
echo "No version change since last commit. Is this really a release?"
exit 1
fi
fi
if [ "$TRAVIS_REPO_SLUG" == "brailleapps/$repo" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
echo -e "Publishing javadoc...\n"
if [ "$is_release" = true ]; then
mkdir -p $HOME/$repo/$version
cp -R build/docs/javadoc $HOME/$repo/$version
fi
mkdir -p $HOME/$repo/latest
cp -R build/docs/javadoc $HOME/$repo/latest
cd $HOME
git config --global user.email "travis@travis-ci.org"
git config --global user.name "travis-ci"
git clone --quiet https://${GH_TOKEN}@github.com/brailleapps/brailleapps.github.io > /dev/null
cd brailleapps.github.io
if [ "$is_release" = true ]; then
git rm -rf ./$repo/$version
fi
git rm -rf ./$repo/latest
cp -Rf $HOME/$repo/. ./$repo
git add -f .
git commit -m "Lastest successful travis build of $repo ($TRAVIS_BUILD_NUMBER) auto-pushed to brailleapps.github.io"
git push -fq origin master > /dev/null
echo -e "Published javadocs to brailleapps.github.io.\n"
fi