xref: /OpenGrok/dev/release.sh (revision ff79dac101c6cc0c68078f077963c1a518e7a3d9)
1fed20fd0SVladimir Kotal#!/bin/bash
2fed20fd0SVladimir Kotal#
3fed20fd0SVladimir Kotal# Trigger new release creation on Github.
4fed20fd0SVladimir Kotal# Assumes working Maven + Git.
5fed20fd0SVladimir Kotal#
6fed20fd0SVladimir Kotal# see https://github.com/OpenGrok/opengrok/wiki/Release-process
7fed20fd0SVladimir Kotal#
8fed20fd0SVladimir Kotal
9bd2770a0SVladimir Kotalset -e
10bd2770a0SVladimir Kotal
11fed20fd0SVladimir Kotalif (( $# != 1 )); then
12fed20fd0SVladimir Kotal	echo "usage: `basename $0` <version>"
13fed20fd0SVladimir Kotal	exit 1
14fed20fd0SVladimir Kotalfi
15fed20fd0SVladimir Kotal
16fed20fd0SVladimir KotalVERSION=$1
17fed20fd0SVladimir Kotal
18*ff79dac1SVladimir Kotalif ! echo "$VERSION" | grep '^[0-9]\+\.[0-9]\+\.[0-9]\+$' >/dev/null; then
19*ff79dac1SVladimir Kotal	echo "version needs to be in the form of <num>.<num>.<num>"
20*ff79dac1SVladimir Kotal	exit 1
21*ff79dac1SVladimir Kotalfi
22*ff79dac1SVladimir Kotal
23fed20fd0SVladimir Kotalif [[ ! -d $PWD/opengrok-indexer ]]; then
24fed20fd0SVladimir Kotal	echo "This needs to be run from top-level directory of the repository"
25fed20fd0SVladimir Kotal	exit 1
26fed20fd0SVladimir Kotalfi
27fed20fd0SVladimir Kotal
28fed20fd0SVladimir Kotalver=$( git tag -l "$VERSION" )
29fed20fd0SVladimir Kotalif (( $? != 0 )); then
30fed20fd0SVladimir Kotal	echo "Cannot determine tag"
31fed20fd0SVladimir Kotal	exit 1
32fed20fd0SVladimir Kotalfi
33fed20fd0SVladimir Kotalif [[ $ver == $VERSION ]]; then
34fed20fd0SVladimir Kotal	echo "Tag $VERSION already exists"
35fed20fd0SVladimir Kotal	exit 1
36fed20fd0SVladimir Kotalfi
37fed20fd0SVladimir Kotal
38bd2770a0SVladimir Kotalgit pull --ff-only
39bd2770a0SVladimir Kotalmvn versions:set -DgenerateBackupPoms=false "-DnewVersion=$VERSION"
40bd2770a0SVladimir Kotalgit commit pom.xml '**/pom.xml' -m "$VERSION"
41bd2770a0SVladimir Kotalgit push
42bd2770a0SVladimir Kotalgit tag "$VERSION"
43bd2770a0SVladimir Kotalgit push origin tag "$VERSION"
44