diff --git a/.travis.yml b/.travis.yml index 5b5ac1ab71..7bfabe7d0d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,15 @@ -# Run `travis lint` when changing this file to avoid breaking the build. -# Default JDK is really old: 1.8.0_31; Trusty's is less old: 1.8.0_51 -# https://docs.travis-ci.com/user/ci-environment/#Virtualization-environments -dist: trusty +dist: xenial sudo: false language: java -jdk: oraclejdk8 + +cache: + directories: + - $HOME/.m2 + +jdk: + - openjdk8 + - openjdk11 + before_install: # Parameters used during release - git config user.name "$GH_USER" @@ -13,35 +18,30 @@ before_install: - git config credential.helper "store --file=.git/credentials" - echo "https://$GH_TOKEN:@github.com" > .git/credentials -install: - # Override default travis to use the maven wrapper - - ./mvnw install -DskipTests=true -Dmaven.javadoc.skip=true -B -V - -script: - - ./travis/publish.sh - -cache: - directories: - - $HOME/.m2 - -matrix: +jobs: include: - - os: linux - jdk: oraclejdk8 - addons: - apt: - packages: - - oracle-java8-installer - - os: linux + - stage: snapshot + name: "Deploy Snapshot to JCenter" + if: branch = master AND type != pull_request jdk: openjdk8 - - os: linux - jdk: openjdk11 - -# Don't build release tags. This avoids publish conflicts because the version commit exists both on master and the release tag. -# See https://github.com/travis-ci/travis-ci/issues/1532 -branches: - except: - - /^[0-9]/ + install: true + script: + - ./mvnw -B -nsu -s ./travis/settings.xml -P release -pl -:feign-benchmark -DskipTests=true deploy + - stage: release + name: "Release to JCenter" + if: tag =~ /^[0-9\.]$/ + jdk: openjdk8 + install: true + script: + - ./mvnw -B -nsu -s ./travis/settings.xml -P release -pl -:feign-benchmark -DskipTests=true deploy + - stage: sync + name: "Sync with Maven Central" + if: tag =~ /^[0-9\.]$/ + jdk: openjdk8 + install: true + script: + # this step can take an inordinate amount of time, so the wait should push it to 30 minutes + - travis_wait 30 ./mvnw -B -nsu -s ./travis/settings.xml -N io.zipkin.centralsync-maven-plugin:centralsync-maven-plugin:sync env: global: diff --git a/RELEASE.md b/RELEASE.md index 78285c2b16..b8995d8dec 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -10,12 +10,16 @@ This repo uses [semantic versions](http://semver.org/). Please keep this in mind 1. **Push a git tag** - The tag should be of the format `release-N.M.L`, for example `release-8.18.0`. + Prepare the next release by running the [release script](travis/release.sh) from a clean checkout of the master branch. + This script will: + * Update all versions to the next release. + * Tag the release. + * Update all versions to the next development version. 1. **Wait for Travis CI** - This part is controlled by [`travis/publish.sh`](travis/publish.sh). It creates a couple commits, bumps the version, - publishes artifacts, syncs to Maven Central. + This part is controlled by the [travis configuration](.travis.yml), specifically the `release` stage. Which + creates the release artifacts and deploys them to maven central. ## Credentials diff --git a/pom.xml b/pom.xml index 768e122b81..10b201f6ae 100644 --- a/pom.xml +++ b/pom.xml @@ -88,6 +88,8 @@ 2.22.0 0.14.3 file://${project.basedir}/src/config/bom.xml + 1.11.2 + 2.7 https://github.com/openfeign/feign 2012 @@ -129,6 +131,11 @@ velo br at gmail dot com about.me/velo + + kdavisk6 + Kevin Davis + kdavisk6@gmail.com + @@ -596,6 +603,19 @@ + + org.codehaus.mojo + versions-maven-plugin + ${maven-versions-plugin.version} + + + org.apache.maven.plugins + maven-scm-plugin + ${maven-scm-plugin.version} + + ${project.version} + + diff --git a/travis/release.sh b/travis/release.sh new file mode 100644 index 0000000000..e8e1578c66 --- /dev/null +++ b/travis/release.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# +# Copyright 2012-2019 The Feign Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# + +function increment() { + local version=$1 + result=`echo ${version} | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF+1)%(10^length($NF))); print}'` + echo "${result}-SNAPSHOT" +} + +# extract the release version from the pom file +version=`./mvnw -o help:evaluate -N -Dexpression=project.version | sed -n '/^[0-9]/p'` +tag=`echo ${version} | cut -d'-' -f 1` + +# determine the next snapshot version +snapshot=$(increment ${tag}) + +echo "release version is: ${tag} and next snapshot is: ${snapshot}" + +# Update the versions, removing the snapshots, then create a new tag for the release, this will +# start the travis-ci release process. +./mvnw -B versions:set scm:checkin -DremoveSnapshot -DgenerateBackupPoms=false -Dmessage="[travis skip] prepare release ${tag}" -DpushChanges=false + +# tag the release +echo "pushing tag ${tag}" +./mvnw scm:tag -DpushChanges=false + +# Update the versions to the next snapshot +./mvnw -B versions:set scm:checkin -DnewVersion="${snapshot}" -DgenerateBackupPoms=false -Dmessage="[travis skip] updating versions to next development iteration ${snapshot}" -DpushChanges=false \ No newline at end of file diff --git a/.settings.xml b/travis/settings.xml similarity index 100% rename from .settings.xml rename to travis/settings.xml