1 #!/bin/bash
2 # Copyright (C) 2012, 2013, 2014 Johan Mattsson
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 rep="$(pwd)"
18 repname="$(basename $(pwd))"
19
20 mkdir -p build
21 cd build
22 rm -rf export
23 mkdir -p export
24 cd export
25
26 version=$(cat ../../scripts/version.py | grep "VERSION = '" | grep -v "SO_VERSION" | sed -e "s:VERSION = '::" | sed "s:'.*::g")
27
28 if ! git diff --exit-code > /dev/null; then
29 echo "Uncommitted changes, commit before creating the release."
30 exit 1
31 fi
32
33 git tag -s v$version -m "Version $version"
34
35 if [ $? -ne 0 ] ; then
36 echo "Can't create release tag"
37 exit 1
38 fi
39
40 echo "Creating a release fo version $version"
41
42 if [ $# -ne 0 -a $# -ne 2 ] ; then
43 echo "Usage: $0 branch version"
44 exit 1
45 fi
46
47 rm -rf birdfont-$version
48
49 if [ "$1" = "" ] ; then
50 echo "No branch specified, exporting master."
51 git clone --depth 1 file://$rep
52 else
53 git clone --depth 1 -b $1 file://$rep
54 fi
55
56 mv $repname birdfont-$version
57
58 rm -rf birdfont-$version/.git
59 rm -rf birdfont-$version/.gitignore
60 rm -rf birdfont-$version/.travis.yml
61
62 cd birdfont-$version
63 python3 ./scripts/complete_translations.py -t 93 -i
64 rm -rf ./scripts/__pycache__
65 cd ..
66
67 tar -cf birdfont-$version.tar birdfont-$version
68
69 xz -z birdfont-$version.tar
70
71 rm -rf ../birdfont-$version.tar.xz
72
73 mv birdfont-$version.tar.xz ../
74
75 # build it to make sure that everything was checked in
76 cd birdfont-$version && \
77 ./configure && \
78 ./scripts/linux_build.py && \
79 gpg --output ../../birdfont-$version.tar.xz.sig --detach-sig ../../birdfont-$version.tar.xz && \
80 cd .. && \
81 rm -rf ../export/birdfont-$version
82