Browse Source

Sync release scripts with zipkin (#647)

pull/653/head
Marvin Froeder 7 years ago committed by GitHub
parent
commit
eb944cf573
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      RELEASE.md
  2. 61
      travis/publish.sh

32
RELEASE.md

@ -38,3 +38,35 @@ Please add the following to your .travis.yml file: @@ -38,3 +38,35 @@ Please add the following to your .travis.yml file:
secure: "mQnECL+dXc5l9wCYl/wUz+AaYFGt/1G31NAZcTLf2RbhKo8mUenc4hZNjHCEv+4ZvfYLd/NoTNMhTCxmtBMz1q4CahPKLWCZLoRD1ExeXwRymJPIhxZUPzx9yHPHc5dmgrSYOCJLJKJmHiOl9/bJi123456="
```
### Troubleshooting invalid credentials
If you receive a '401 unauthorized' failure from jCenter or Bintray, it is
likely `BINTRAY_USER` or `BINTRAY_KEY` entries are invalid, or possibly the user
associated with them does not have rights to upload.
The least destructive test is to try to publish a snapshot manually. By passing
the values Travis would use, you can kick off a snapshot from your laptop. This
is a good way to validate that your unencrypted credentials are authorized.
Here's an example of a snapshot deploy with specified credentials.
```bash
$ BINTRAY_USER=adrianmole BINTRAY_KEY=ed6f20bde9123bbb2312b221 TRAVIS_PULL_REQUEST=false TRAVIS_TAG= TRAVIS_BRANCH=master travis/publish.sh
```
## First release of the year
The license plugin verifies license headers of files include a copyright notice indicating the years a file was affected.
This information is taken from git history. There's a once-a-year problem with files that include version numbers (pom.xml).
When a release tag is made, it increments version numbers, then commits them to git. On the first release of the year,
further commands will fail due to the version increments invalidating the copyright statement. The way to sort this out is
the following:
Before you do the first release of the year, move the SNAPSHOT version back and forth from whatever the current is.
In-between, re-apply the licenses.
```bash
$ ./mvnw versions:set -DnewVersion=1.3.3-SNAPSHOT -DgenerateBackupPoms=false
$ ./mvnw com.mycila:license-maven-plugin:format
$ ./mvnw versions:set -DnewVersion=1.3.2-SNAPSHOT -DgenerateBackupPoms=false
$ git commit -am"Adjusts copyright headers for this year"
```

61
travis/publish.sh

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
#!/usr/bin/env bash
#
# Copyright 2012-2018 The Feign Authors
#
@ -73,8 +74,12 @@ check_release_tag() { @@ -73,8 +74,12 @@ check_release_tag() {
fi
}
print_project_version() {
./mvnw help:evaluate -N -Dexpression=project.version|sed -n '/^[0-9]/p'
}
is_release_commit() {
project_version=$(./mvnw help:evaluate -N -Dexpression=project.version|sed -n '/^[0-9]/p')
project_version="$(print_project_version)"
if [[ "$project_version" =~ ^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$ ]]; then
echo "Build started by release commit $project_version. Will synchronize to maven central."
return 0
@ -101,6 +106,49 @@ safe_checkout_master() { @@ -101,6 +106,49 @@ safe_checkout_master() {
fi
}
javadoc_to_gh_pages() {
version="$(print_project_version)"
rm -rf javadoc-builddir
builddir="javadoc-builddir/$version"
# Collect javadoc for all modules
for jar in $(find . -name "*${version}-javadoc.jar"); do
module="$(echo "$jar" | sed "s~.*/\(.*\)-${version}-javadoc.jar~\1~")"
this_builddir="$builddir/$module"
if [ -d "$this_builddir" ]; then
# Skip modules we've already processed.
# We may find multiple instances of the same javadoc jar because of, for instance,
# integration tests copying jars around.
continue
fi
mkdir -p "$this_builddir"
unzip "$jar" -d "$this_builddir"
# Build a simple module-level index
echo "<li><a href=\"${module}/index.html\">${module}</a></li>" >> "${builddir}/index.html"
done
# Update gh-pages
git fetch origin gh-pages:gh-pages
git checkout gh-pages
rm -rf "$version"
mv "javadoc-builddir/$version" ./
rm -rf "javadoc-builddir"
# Update simple version-level index
if ! grep "$version" index.html 2>/dev/null; then
echo "<li><a href=\"${version}/index.html\">${version}</a></li>" >> index.html
fi
# Ensure links are ordered by versions, latest on top
sort -rV index.html > index.html.sorted
mv index.html.sorted index.html
git add "$version"
git add index.html
git commit -m "Automatically updated javadocs for $version"
git push origin gh-pages
}
#----------------------
# MAIN
#----------------------
@ -110,24 +158,27 @@ if ! is_pull_request && build_started_by_tag; then @@ -110,24 +158,27 @@ if ! is_pull_request && build_started_by_tag; then
check_release_tag
fi
./mvnw install -nsu
# skip license on travis due to #1512
./mvnw install -nsu -Dlicense.skip=true
# If we are on a pull request, our only job is to run tests, which happened above via ./mvnw install
if is_pull_request; then
true
# If we are on master, we will deploy the latest snapshot or release version
# - If a release commit fails to deploy for a transient reason, delete the broken version from bintray and click rebuild
elif is_travis_branch_master; then
./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DskipTests deploy
./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -pl -:benchmark -DskipTests deploy
# If the deployment succeeded, sync it to Maven Central. Note: this needs to be done once per project, not module, hence -N
if is_release_commit; then
./mvnw --batch-mode -s ./.settings.xml -nsu -N io.zipkin.centralsync-maven-plugin:centralsync-maven-plugin:sync
javadoc_to_gh_pages
fi
# If we are on a release tag, the following will update any version references and push a version tag for deployment.
elif build_started_by_tag; then
safe_checkout_master
./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DreleaseVersion="$(release_version)" -Darguments="-DskipTests" release:prepare
# skip license on travis due to #1512
./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DreleaseVersion="$(release_version)" -Darguments="-DskipTests -Dlicense.skip=true" release:prepare
fi

Loading…
Cancel
Save