-
Notifications
You must be signed in to change notification settings - Fork 159
/
upload-site.sh
executable file
·48 lines (46 loc) · 1.37 KB
/
upload-site.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
#!/bin/sh
URL=github.com:maven-nar/maven-nar.github.com &&
git fetch "$URL" master &&
for d in /usr/lib/jvm/java-7-openjdk-amd64/
do
if test -d "$d"
then
echo "Using Java 7 for prettier javadocs" &&
export JAVA_HOME="$d" &&
export PATH="$JAVA_HOME/bin:$PATH" &&
break
fi
done &&
mvn clean site &&
export GIT_INDEX_FILE=.git/tmp-index &&
rm -f $GIT_INDEX_FILE &&
for d in nar-maven-plugin maven-nar-plugin
do
mkdir -p target/site/$d &&
cat > target/site/$d/index.html << EOF
<!DOCTYPE html>
<html>
<head>
<title>Redirecting to the homepage of the NAR plugin for Maven</title>
<meta http-equiv=refresh content="1;url=../index.html"/>
</head>
<body>
<h1>Redirecting to the homepage of the NAR plugin for Maven</h1>
If you are not redirected automatically, please click <a href=../index.html>here</a>.
</body>
</html>
EOF
done &&
git add -f target/site &&
TREE=$(git write-tree) &&
unset GIT_INDEX_FILE &&
TREE=$(git rev-parse $TREE:target/site) &&
COMMIT=$(printf "Update %s from %s\n\n%s\n\n%s" \
"http://maven-nar.github.io/" \
"$(git rev-parse --short HEAD)" \
"This trick was performed by these commands:" \
"$(cat "$0" | sed 's/^/ /')" |
git commit-tree $TREE -p FETCH_HEAD) &&
git update-ref -m "Generated by mvn site" \
FETCH_HEAD $COMMIT &&
git push $URL FETCH_HEAD:master