blob: 54d9127f0065623c6893283d93d9366523e97d11 [file] [log] [blame]
#*******************************************************************************
# Copyright (c) 2010, 2013 Sonatype, Inc.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Stuart McCulloch (Sonatype, Inc.) - initial API and implementation
#*******************************************************************************
#!/bin/sh
set -e
VERSION=$1
MESSAGE=$2
if [[ ! "${VERSION}" =~ ^0.([0-9]+).([0-9]+)$ || "${MESSAGE}" =~ ^\ *$ ]]
then
echo "Usage: perform_release.sh <0.?.?> <message>"
exit 1
fi
git fetch --tags
if git show-ref -q --tags refs/tags/releases/${VERSION}
then
echo "Tag releases/${VERSION} already exists"
exit 1
fi
if ! git show-ref -q refs/heads/staging-${VERSION}
then
echo "Branch staging-${VERSION} does not exist"
exit 1
fi
rm -fr target/checkout
git clone -l --branch staging-${VERSION} . target/checkout
GPG_KEYNAME=${GPG_KEYNAME:-${USER}}
mvn deploy -Psonatype-oss-release -Dgpg.keyname=${GPG_KEYNAME} -f target/checkout/pom.xml \
-Ddescription="${PWD##*/}/${VERSION} : ${MESSAGE}"
git tag -u ${GPG_KEYNAME} releases/${VERSION} staging-${VERSION} -m "${MESSAGE}"
git tag -v releases/${VERSION}
git checkout master ; git merge staging-${VERSION}
MINOR_MICRO=${VERSION#*.}
NEW_VERSION=${VERSION%%.*}.$((${MINOR_MICRO%%.*}+1)).0-SNAPSHOT
mvn org.eclipse.tycho:tycho-versions-plugin:0.17.0:set-version -DnewVersion=${NEW_VERSION}
git add . ; git commit -m "Prepare for next round of development"