Skip to content

Commit 20aa983

Browse files
author
Fernando Saint-Jean
committed
resyncs the travis publish file
1 parent e5f98c3 commit 20aa983

File tree

1 file changed

+69
-5
lines changed

1 file changed

+69
-5
lines changed

travis/publish.sh

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env bash
12
#
23
# Copyright 2017-2019 The Feign Authors
34
#
@@ -73,8 +74,12 @@ check_release_tag() {
7374
fi
7475
}
7576

77+
print_project_version() {
78+
./mvnw help:evaluate -N -Dexpression=project.version|sed -n '/^[0-9]/p'
79+
}
80+
7681
is_release_commit() {
77-
project_version=$(./mvnw help:evaluate -N -Dexpression=project.version|sed -n '/^[0-9]/p')
82+
project_version="$(print_project_version)"
7883
if [[ "$project_version" =~ ^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$ ]]; then
7984
echo "Build started by release commit $project_version. Will synchronize to maven central."
8085
return 0
@@ -101,6 +106,49 @@ safe_checkout_master() {
101106
fi
102107
}
103108

109+
javadoc_to_gh_pages() {
110+
version="$(print_project_version)"
111+
rm -rf javadoc-builddir
112+
builddir="javadoc-builddir/$version"
113+
114+
# Collect javadoc for all modules
115+
for jar in $(find . -name "*${version}-javadoc.jar"); do
116+
module="$(echo "$jar" | sed "s~.*/\(.*\)-${version}-javadoc.jar~\1~")"
117+
this_builddir="$builddir/$module"
118+
if [ -d "$this_builddir" ]; then
119+
# Skip modules we've already processed.
120+
# We may find multiple instances of the same javadoc jar because of, for instance,
121+
# integration tests copying jars around.
122+
continue
123+
fi
124+
mkdir -p "$this_builddir"
125+
unzip "$jar" -d "$this_builddir"
126+
# Build a simple module-level index
127+
echo "<li><a href=\"${module}/index.html\">${module}</a></li>" >> "${builddir}/index.html"
128+
done
129+
130+
# Update gh-pages
131+
git fetch origin gh-pages:gh-pages
132+
git checkout gh-pages
133+
rm -rf "$version"
134+
mv "javadoc-builddir/$version" ./
135+
rm -rf "javadoc-builddir"
136+
137+
# Update simple version-level index
138+
if ! grep "$version" index.html 2>/dev/null; then
139+
echo "<li><a href=\"${version}/index.html\">${version}</a></li>" >> index.html
140+
fi
141+
142+
# Ensure links are ordered by versions, latest on top
143+
sort -rV index.html > index.html.sorted
144+
mv index.html.sorted index.html
145+
146+
git add "$version"
147+
git add index.html
148+
git commit -m "Automatically updated javadocs for $version"
149+
git push origin gh-pages
150+
}
151+
104152
#----------------------
105153
# MAIN
106154
#----------------------
@@ -110,23 +158,39 @@ if ! is_pull_request && build_started_by_tag; then
110158
check_release_tag
111159
fi
112160

113-
./mvnw install -nsu -Dgpg.skip=true
161+
# skip license on travis due to #1512
162+
./mvnw install -nsu -Dlicense.skip=true
163+
164+
# formatter errors:
165+
if [ -z $(git status --porcelain) ];
166+
then
167+
echo "No changes detected, all good"
168+
else
169+
echo "The following files have formatting changes:"
170+
git status --porcelain
171+
echo ""
172+
echo "Please run 'mvn clean install' locally to format files"
173+
exit 1
174+
fi
114175

115176
# If we are on a pull request, our only job is to run tests, which happened above via ./mvnw install
116177
if is_pull_request; then
117178
true
179+
118180
# If we are on master, we will deploy the latest snapshot or release version
119181
# - If a release commit fails to deploy for a transient reason, delete the broken version from bintray and click rebuild
120182
elif is_travis_branch_master; then
121-
./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DskipTests -Dgpg.skip=true deploy
183+
./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -pl -:feign-benchmark -DskipTests -Dgpg.skip=true deploy
122184

123185
# If the deployment succeeded, sync it to Maven Central. Note: this needs to be done once per project, not module, hence -N
124186
if is_release_commit; then
125187
./mvnw --batch-mode -s ./.settings.xml -nsu -Dgpg.skip=true -N io.zipkin.centralsync-maven-plugin:centralsync-maven-plugin:sync
188+
javadoc_to_gh_pages
126189
fi
127190

128191
# If we are on a release tag, the following will update any version references and push a version tag for deployment.
129192
elif build_started_by_tag; then
130193
safe_checkout_master
131-
./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DreleaseVersion="$(release_version)" -Darguments="-DskipTests -Dgpg.skip=true" release:prepare
132-
fi
194+
# skip license on travis due to #1512
195+
./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DreleaseVersion="$(release_version)" -Darguments="-DskipTests -Dlicense.skip=true -Dgpg.skip=true" release:prepare
196+
fi

0 commit comments

Comments
 (0)