blob: 9deca8f73ba3e8546160c9da0186383845637c41 [file] [log] [blame]
#!/bin/bash -e
if [ "$1" == "" ] || [ "$2" == "" ]
echo "Gerrit Code Review - release automation script"
echo "----------------------------------------------"
echo "Use: $0 <branch> <version>"
echo ""
echo "Where: branch Gerrit branch name where the release must be cut"
echo " version Gerrit semantic release number"
echo ""
echo "Example: $0 stable-2.16 2.16.1"
exit 1
export branch=$1
export version=$2
if [ -d gerrit ]
rm -Rf gerrit
echo "Cloning and building Gerrit Code Review on branch $branch ..."
git clone && (cd gerrit && f=`git rev-parse --git-dir`/hooks/commit-msg ; curl -Lo $f ; chmod +x $f)
pushd gerrit
source 8
git checkout $branch
git fetch && git reset --hard origin/$branch
git submodule update --init
git clean -fdx
./tools/ $version
git commit -a -m "Set version to $version"
git tag -f -s -m "v$version" "v$version"
git submodule foreach git tag -f -s -m "v$version" "v$version"
bazel build release Documentation:searchfree
./tools/maven/ install
echo -n "Checking Gerrit version ... "
warVersion=$(java -jar bazel-bin/release.war --version)
if ! [ "$warVersion" == "gerrit version $version" ]
echo "Version build is $warVersion but was expecting $version"
exit 2
echo "OK"
echo "Checking Gerrit plugins version ... "
java -jar bazel-bin/release.war init --list-plugins
echo "Publishing Gerrit WAR and APIs to Maven Central ..."
export VERBOSE=1
./tools/maven/ war_deploy
./tools/maven/ deploy
echo "Download the artifacts from SonaType staging repository at"
echo "logging in using your credentials"
cp -f gerrit/bazel-bin/Documentation/ .
cp -f gerrit/bazel-bin/release.war gerrit-$version.war
echo "gerrit.war checksums"
shasum gerrit-$version.war
shasum -a 256 gerrit-$version.war
md5sum gerrit-$version.war
echo "Pushing to Google Cloud Buckets"
gcloud auth login
echo "Pushing gerrit.war to gerrit-releases ..."
gsutil cp gerrit-$version.war gs://gerrit-releases/gerrit-$version.war
echo "Pushing gerrit documentation to gerrit-documentation ..."
pushd Documentation
gsutil cp -r . gs://gerrit-documentation/Documentation/$version
echo "Release completed"