.
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
19 mkdir -p build
20 cd build
21 mkdir -p export
22 cd export
23
24 version=$(cat ../../scripts/version.py | grep "VERSION = '" | grep -v "SO_VERSION" | sed -e "s:VERSION = '::" | sed "s:'.*::g")
25
26 if ! git diff --exit-code > /dev/null; then
27 echo "Uncommitted changes, commit before creating the release."
28 exit 1
29 fi
30
31 git tag -a v$version -m "Version $version"
32
33 if [ $? -ne 0 ] ; then
34 echo "Can't create release tag"
35 exit 1
36 fi
37
38 echo "Creating a release fo version $version"
39
40 if [ $# -ne 0 -a $# -ne 2 ] ; then
41 echo "Usage: $0 branch version"
42 exit 1
43 fi
44
45 rm -rf birdfont-$version
46
47 if [ "$1" = "" ] ; then
48 echo "No branch specified, exporting master."
49 git clone --depth 1 file://$rep
50 else
51 git clone --depth 1 -b $1 file://$rep
52 fi
53
54 mv birdfont birdfont-$version
55
56 rm -rf birdfont-$version/.git
57 rm -rf birdfont-$version/.gitignore
58 rm -rf birdfont-$version/.travis.yml
59
60 cd birdfont-$version
61 python3 ./scripts/complete_translations.py -t 93 -i
62 rm -rf ./scripts/__pycache__
63 cd ..
64
65 tar -cf birdfont-$version.tar birdfont-$version
66
67 xz -z birdfont-$version.tar
68
69 rm -rf ../birdfont-$version.tar.xz
70
71 mv birdfont-$version.tar.xz ../
72
73 # build it to make sure that everything was checked in
74 cd birdfont-$version && \
75 ./configure && \
76 ./scripts/linux_build.py && \
77 gpg --output ../../birdfont-$version.tar.xz.sig --detach-sig ../../birdfont-$version.tar.xz && \
78 cd .. && \
79 rm -rf ../export/birdfont-$version
80