forked from owlike/genson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-doc.sh
executable file
·46 lines (31 loc) · 1.48 KB
/
deploy-doc.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
#!/bin/bash
niceMessage() {
echo "========================================================================================================================\n\
\t$1\n\
========================================================================================================================"
}
runCommand() {
eval "$1"
ret_code=$?
if [ $ret_code != 0 ]; then
niceMessage "$2"
exit $ret_code
fi
}
runSuite() {
for cmd in "$@"
do
runCommand "$cmd" "Failed to execute command: $cmd"
done
}
#runCommand "git diff-index --quiet origin/HEAD --" "You have uncommited changes, please commit and push to origin everything before deploying the doc.";
runSuite "mvn clean package -DskipTests"
version=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version|grep -Ev '(^\[|Download\w+:)')
runSuite "git clone https://github.com/owlike/genson.git tmp_website" "cd tmp_website" "git checkout gh-pages" "rm -R *"
echo -e "latest_version: $version \nproduction: true" > _config-release.yml
cat _config-release.yml
runSuite "jekyll build --source ../website --destination . --config ../website/_config.yml,_config-release.yml"
rm _config-release.yml
runSuite "cp -R ../genson/target/apidocs Documentation/Javadoc" "cp -R ../genson-scala/target/apidocs Documentation/Scaladoc"
runSuite "git add -u ." "git add ." "git commit -m \"Documentation Release $version\"" "git push origin gh-pages"
runSuite "cd .." "rm -Rf tmp_website"