release.sh 1.51 KB
Newer Older
1
#!/usr/bin/env bash
Romain Bignon's avatar
Romain Bignon committed
2
# This script is used to release a version.
3
set -e
Romain Bignon's avatar
Romain Bignon committed
4 5

function set_version {
Romain Bignon's avatar
Romain Bignon committed
6
	echo -n "Replacing version in source files to $1"
7
	for fl in $(find . -iregex ".*\.\(py\|rst\)$" ! -path "./contrib/*"); do
8
        sed "s/^\(\s*\)\(VERSION\|version\|release\)\( *\)=\( *\)[\"'][0-9]\+\..\+[\"']\(,\?\)$/\1\2\3=\4'$1'\5/g" $fl > $fl.new
Romain Bignon's avatar
Romain Bignon committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
		diff $fl.new $fl >/dev/null && echo -n "." || echo -n "+"
		cp -f $fl.new $fl
		rm -f $fl.new
	done

	echo -e " done.\n"
}

if [ "$1" = "" ]; then
	echo "Syntax: $0 VERSION"
	exit 1
fi

VERSION=$1

24
export LANG=en_US.utf8
Romain Bignon's avatar
Romain Bignon committed
25 26 27 28 29 30 31 32 33
mv ChangeLog ChangeLog.old
echo -e "Weboob $VERSION (`date +%Y-%m-%d`)\n\t \n\n" > ChangeLog
cat ChangeLog.old >> ChangeLog
rm -f ChangeLog.old

vi +2 ChangeLog

set_version $VERSION

34
echo "Building Qt applications..."
35
./setup.py --qt sdist bdist clean -a || exit 1
36

37
echo "Generating manpages..."
38
tools/make_man.sh
39 40
echo -e "done!\n"

41 42 43
# in case there are new manpages not included in the git tree.
git add man/*

Romain Bignon's avatar
Romain Bignon committed
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
echo "Release commit:"
git commit -a -m "Weboob $VERSION released"
echo -ne "\n"

echo "Release tag:"
git tag $VERSION -s -m "Weboob $VERSION"
echo -ne "\n"

echo -n "Generating archive.. "
git archive HEAD --prefix=weboob-$VERSION/ -o weboob-$VERSION.tar
gzip -f weboob-$VERSION.tar
md5sum weboob-$VERSION.tar.gz

echo -ne "\nDo you want to change the version number (y/n) "
read change_version

if [ "$change_version" = "y" ]; then
	echo -n "Enter the new version number: "
	read NEW_VERSION
	set_version $NEW_VERSION
	git commit -a -m "bump to $NEW_VERSION"
fi