Skip to content

Commit eb944cf

Browse files
authored
Sync release scripts with zipkin (OpenFeign#647)
1 parent 14cbeb4 commit eb944cf

File tree

2 files changed

+88
-5
lines changed

2 files changed

+88
-5
lines changed

RELEASE.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,35 @@ Please add the following to your .travis.yml file:
3838
3939
secure: "mQnECL+dXc5l9wCYl/wUz+AaYFGt/1G31NAZcTLf2RbhKo8mUenc4hZNjHCEv+4ZvfYLd/NoTNMhTCxmtBMz1q4CahPKLWCZLoRD1ExeXwRymJPIhxZUPzx9yHPHc5dmgrSYOCJLJKJmHiOl9/bJi123456="
4040
```
41+
42+
### Troubleshooting invalid credentials
43+
44+
If you receive a '401 unauthorized' failure from jCenter or Bintray, it is
45+
likely `BINTRAY_USER` or `BINTRAY_KEY` entries are invalid, or possibly the user
46+
associated with them does not have rights to upload.
47+
48+
The least destructive test is to try to publish a snapshot manually. By passing
49+
the values Travis would use, you can kick off a snapshot from your laptop. This
50+
is a good way to validate that your unencrypted credentials are authorized.
51+
52+
Here's an example of a snapshot deploy with specified credentials.
53+
```bash
54+
$ BINTRAY_USER=adrianmole BINTRAY_KEY=ed6f20bde9123bbb2312b221 TRAVIS_PULL_REQUEST=false TRAVIS_TAG= TRAVIS_BRANCH=master travis/publish.sh
55+
```
56+
57+
## First release of the year
58+
59+
The license plugin verifies license headers of files include a copyright notice indicating the years a file was affected.
60+
This information is taken from git history. There's a once-a-year problem with files that include version numbers (pom.xml).
61+
When a release tag is made, it increments version numbers, then commits them to git. On the first release of the year,
62+
further commands will fail due to the version increments invalidating the copyright statement. The way to sort this out is
63+
the following:
64+
65+
Before you do the first release of the year, move the SNAPSHOT version back and forth from whatever the current is.
66+
In-between, re-apply the licenses.
67+
```bash
68+
$ ./mvnw versions:set -DnewVersion=1.3.3-SNAPSHOT -DgenerateBackupPoms=false
69+
$ ./mvnw com.mycila:license-maven-plugin:format
70+
$ ./mvnw versions:set -DnewVersion=1.3.2-SNAPSHOT -DgenerateBackupPoms=false
71+
$ git commit -am"Adjusts copyright headers for this year"
72+
```

travis/publish.sh

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env bash
12
#
23
# Copyright 2012-2018 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,24 +158,27 @@ if ! is_pull_request && build_started_by_tag; then
110158
check_release_tag
111159
fi
112160

113-
./mvnw install -nsu
161+
# skip license on travis due to #1512
162+
./mvnw install -nsu -Dlicense.skip=true
114163

115164
# If we are on a pull request, our only job is to run tests, which happened above via ./mvnw install
116165
if is_pull_request; then
117166
true
167+
118168
# If we are on master, we will deploy the latest snapshot or release version
119169
# - If a release commit fails to deploy for a transient reason, delete the broken version from bintray and click rebuild
120170
elif is_travis_branch_master; then
121-
./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DskipTests deploy
171+
./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -pl -:benchmark -DskipTests deploy
122172

123173
# If the deployment succeeded, sync it to Maven Central. Note: this needs to be done once per project, not module, hence -N
124174
if is_release_commit; then
125175
./mvnw --batch-mode -s ./.settings.xml -nsu -N io.zipkin.centralsync-maven-plugin:centralsync-maven-plugin:sync
176+
javadoc_to_gh_pages
126177
fi
127178

128179
# If we are on a release tag, the following will update any version references and push a version tag for deployment.
129180
elif build_started_by_tag; then
130181
safe_checkout_master
131-
./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DreleaseVersion="$(release_version)" -Darguments="-DskipTests" release:prepare
182+
# skip license on travis due to #1512
183+
./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DreleaseVersion="$(release_version)" -Darguments="-DskipTests -Dlicense.skip=true" release:prepare
132184
fi
133-

0 commit comments

Comments
 (0)