Skip to content

Commit

Permalink
Fix regex and only attempt to deploy if artifacts don't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajay Kannan committed Apr 6, 2016
1 parent 5204fdc commit 72aafe4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This script takes an optional argument denoting the new version. By default, if
2. Create a PR to update the pom.xml version. If releasing a new client library, this PR should also update javadoc grouping in the base directory's [pom.xml](./pom.xml).
PRs that don't release new modules should look something like [#225](https://github.com/GoogleCloudPlatform/gcloud-java/pull/225). PRs that do release a new module should also add the appropriate packages to the javadoc groups "SPI" and "Test helpers", as shown in [#802](https://github.com/GoogleCloudPlatform/gcloud-java/pull/802) for `gcloud-java-dns`. After this PR is merged into GoogleCloudPlatform/gcloud-java, Travis CI will push a new website to GoogleCloudPlatform/gh-pages, push a new artifact to the Maven Central Repository, and update versions in the README files. Do not merge in any non-release-related pull requests between the start of step 2 and the end of step 6. Between these steps, the project version is a non-snapshot version, so any commits to the master branch will cause Travis to spend extra resources attempting to redeploy artifacts.

3. Before moving on, verify that the artifacts have successfully been pushed to the Maven Central Repository. Open Travis CI, click the ["Build History" tab](https://travis-ci.org/GoogleCloudPlatform/gcloud-java/builds), and open the second build's logs for Step 2's PR. Be sure that you are not opening the "Pull Request" build logs. When the build finishes, scroll to the end of the log and verify that the artifacts were successfully staged and deployed. Search for `gcloud-java` on the [Sonatype website](https://oss.sonatype.org/#nexus-search;quick~gcloud-java) and check the latest version number. In rare cases (when the Maven plugin that determines the version of the repository fails), the artifacts may not be deployed even if the version in the pom.xml files don't contain `SNAPSHOT`. If the artifacts weren't deployed due to invalid version parsing or a flaky test, rerun the build.
3. Before moving on, verify that the artifacts have successfully been pushed to the Maven Central Repository. Open Travis CI, click the ["Build History" tab](https://travis-ci.org/GoogleCloudPlatform/gcloud-java/builds), and open the second build's logs for Step 2's PR. Be sure that you are not opening the "Pull Request" build logs. When the build finishes, scroll to the end of the log and verify that the artifacts were successfully staged and deployed. Search for `gcloud-java` on the [Sonatype website](https://oss.sonatype.org/#nexus-search;quick~gcloud-java) and check the latest version number. In rare cases (when the Maven plugin that determines the version of the repository fails), the artifacts may not be deployed even if the version in the pom.xml files doesn't contain `SNAPSHOT`. If the artifacts weren't deployed due to invalid version parsing or a flaky test, rerun the build.

4. Publish a release on Github manually.
Go to the [releases page](https://github.com/GoogleCloudPlatform/gcloud-java/releases) and open the appropriate release draft. Make sure the "Tag Version" is `vX.Y.Z` and the "Release Title" is `X.Y.Z`, where `X.Y.Z` is the release version as listed in the `pom.xml` files. The draft should already have all changes that impact users since the previous release. To double check this, you can use the `git log` command and look through the merged master branch pull requests. Here is an example of the log command to get non-merge commits between v0.0.12 and v0.1.0:
Expand Down
7 changes: 5 additions & 2 deletions utilities/after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ if [ "${TRAVIS_JDK_VERSION}" == "oraclejdk7" ]; then
exit 1
fi
if [ "${SITE_VERSION##*-}" != "SNAPSHOT" ]; then
# Deploy Maven artifacts and update artifact version in READMEs
mvn clean deploy -DskipITs --settings ~/.m2/settings.xml -P sign-deploy
# Deploy Maven artifacts (if they don't exist yet) and update artifact version in READMEs.
ARTIFACT_EXISTS=$(mvn wagon:exist -Dwagon.url=https://oss.sonatype.org/content/repositories/releases/com/google/gcloud/gcloud-java/$SITE_VERSION)
if [[ "$ARTIFACT_EXISTS" == *"does not exists."* -a "$ARTIFACT_EXISTS" != "" ]]; then
mvn clean deploy -DskipITs --settings ~/.m2/settings.xml -P sign-deploy
fi
utilities/update_docs_version.sh

# Create website
Expand Down
2 changes: 1 addition & 1 deletion utilities/update_docs_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RELEASED_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate
if [ "${RELEASED_VERSION##*-}" != "SNAPSHOT" ]; then
echo "Changing version to $RELEASED_VERSION in README files"
# Get list of directories for which README.md must be updated
module_folders=($(find . -maxdepth 2 \( -regex "./gcloud-java-[a-z]*" -o -regex "./gcloud-java-contrib/gcloud-java-[a-z]*" \) -type d) . ./gcloud-java)
module_folders=($(find . -maxdepth 2 \( -regex "./gcloud-java[-[a-z]+]*" -o -regex "./gcloud-java-contrib/gcloud-java[-[a-z]+]*" \) -type d) . ./gcloud-java)
for item in ${module_folders[*]}
do
sed -ri "s/<version>[0-9]+\.[0-9]+\.[0-9]+<\/version>/<version>${RELEASED_VERSION}<\/version>/g" ${item}/README.md
Expand Down
3 changes: 1 addition & 2 deletions utilities/update_pom_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
# Get the previous maven project version.
CURRENT_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|\w+:)')
# Get list of directories for which pom.xml must be updated
module_folders=($(find . -maxdepth 2 -name 'gcloud-java*' -type d) .)

module_folders=($(find . -maxdepth 2 \( -regex "./gcloud-java[-[a-z]+]*" -o -regex "./gcloud-java-contrib/gcloud-java[-[a-z]+]*" \) -type d) . ./gcloud-java)
if [ $# -eq 1 ]; then
NEW_VERSION=$1
elif [ "${CURRENT_VERSION##*-}" != "SNAPSHOT" ]; then
Expand Down

0 comments on commit 72aafe4

Please sign in to comment.