diff --git a/Documentation/dev-release.txt b/Documentation/dev-release.txt index b3fef8af69..2495233616 100644 --- a/Documentation/dev-release.txt +++ b/Documentation/dev-release.txt @@ -296,6 +296,17 @@ included in the next Gerrit release. Update the Gerrit version in the for review and get it merged. +[[publish-plugins-archetypes-to-maven-central]] +=== Publish plugin archetypes to Maven Central + +Make sure you have done the +link:dev-release-deploy-config.html#deploy-configuration-setting-maven-central[ +configuration needed for deployment] + +---- + ./tools/plugin_archetype_deploy.sh +---- + [[merge-stable]] === Merge `stable` into `master` diff --git a/tools/plugin_archetype_deploy.sh b/tools/plugin_archetype_deploy.sh new file mode 100755 index 0000000000..929e1fd59d --- /dev/null +++ b/tools/plugin_archetype_deploy.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# Copyright (C) 2014 The Android Open Source Project +# +# 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. + +help() +{ + cat <<'eof' +Usage: plugin_archetype_deploy [option] + +Deploys Gerrit plugin Maven archetypes to Maven Central + +Valid options: + --help show this message + --dry-run don't execute commands, just print them +eof +exit +} + +function getver +{ + grep "$1" $root/VERSION | sed "s/.*'\(.*\)'/\1/" +} + +function instroot +{ + bindir=${0%/*} + + case $bindir in + ./*) bindir=$PWD/$bindir ;; + esac + + cd $bindir/.. + pwd +} + +function doIt +{ + case $dryRun in + true) echo "$@" ;; + *) "$@" ;; + esac +} + +function build_and_deploy +{ + module=${PWD##*/} + doIt mvn package gpg:sign-and-deploy-file \ + -Durl=$url \ + -DrepositoryId=sonatype-nexus-staging \ + -DpomFile=pom.xml \ + -Dfile=target/$module-$ver.jar +} + +while [ $# -gt 0 ]; do + test "$1" == --dry-run && dryRun=true + test "$1" == --help && help + shift +done + +root=$(instroot) +cd "$root" +ver=$(getver GERRIT_VERSION) +[[ $ver == *-SNAPSHOT ]] \ + && url="https://oss.sonatype.org/content/repositories/snapshots" \ + || url="https://oss.sonatype.org/service/local/staging/deploy/maven2" + +for d in gerrit-plugin-archetype \ + gerrit-plugin-js-archetype \ + gerrit-plugin-gwt-archetype ; do + (cd "$d"; build_and_deploy) +done +