summaryrefslogtreecommitdiff
path: root/tag-release
blob: a1e916ff875d7928b20c1c3038fe097b2dbfd95b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash

if [ -z $1 ]; then
	echo "Please specify a version"
	exit
fi

abort() {
	echo $1
	exit 1
}

FULLVERSION=$1
VERSION=${FULLVERSION/-*/}

echo "Full version: $FULLVERSION"
echo "Version: $VERSION"

sed -i -e "/^\$version =/ c \$version = '$FULLVERSION'" launch_here.rb
sed -i -e "/^\$version ||=/ c \$version ||= '$FULLVERSION'" bin/rbot
sed -i -e "/^  s.version =/ c \  s.version = '$VERSION'" rbot.gemspec
sed -i -e "/^  <!ENTITY dhpackageversion / c \  <!ENTITY dhpackageversion \"$VERSION\">" man/*.xml

NOGIT=${FULLVERSION/-git/}
if [ $NOGIT == $FULLVERSION ]; then
	# Not a git version
	rake package || abort "Failed to build package!"
	git commit -m "Version $FULLVERSION" -a || abort "Failed to commit release!"
	git tag -a -m "rbot $FULLVERSION" rbot-$FULLVERSION || abort "Failed to tag release!"
	if [ $VERSION != $FULLVERSION ]; then
		pushd pkg
		mv rbot-$VERSION.gem rbot-$FULLVERSION.gem
		mv rbot-$VERSION.tgz rbot-$FULLVERSION.tgz
		mv rbot-$VERSION.zip rbot-$FULLVERSION.zip
		popd
	fi
else
	# git version
	git commit -m "Start working on $NOGIT" -a
fi