forked from MetPX/sarracenia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·110 lines (90 loc) · 3.09 KB
/
release.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
# This file is part of sarracenia.
# The sarracenia suite is Free and is proudly provided by the Government of Canada
# Copyright (C) Her Majesty The Queen in Right of Canada, Environment Canada, 2008-2015
#
# sarracenia repository: https://github.com/MetPX/sarracenia
# Documentation: https://github.com/MetPX/sarracenia/blob/master/doc/sr_subscribe.1.rst#documentation
#
# release.sh : create a new release of metpx-sarracenia
#
#
# Code contributed by:
# Khosrow Ebrahimpour - Shared Services Canada
# Last Changed : Dec 9 11:27:17 EST 2015
# Last Revision : Dec 9 11:27:17 EST 2015
#
########################################################################
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Assumptions:
# 1. sarra/__init__.py exists and has the desired version number
#
# Steps:
# 1. Update debian/changelog using "dch command"
# 2. Commit debian/changelog to git
# 3. perform 'git tag' operation using version provided
usage() {
echo "`basename $0` <release message>"
echo
echo "Ex: `basename $0` 'releasing alpha1'"
exit 2
}
if [ $# -ne 1 ]; then
usage
fi
# VERSION=$1
MSG=$1
# Verify sarra/__init__.py has the same version
VERSION=`grep __version__ sarra/__init__.py | cut -c15- | sed -e 's/"//g'`
# Verify version format
if [[ ! $VERSION =~ ^[0-9]\.[0-9]{2}\.[0-9]{2} ]]; then
echo "ERROR: Version number must begin with P.YY.MM"
echo
echo "Where P is the numeric protocol version, YY is the year, and MM is the month"
echo
echo "Please correct the version number in sarra/__init__.py"
exit 1
fi
while [ 1 ]; do
read -e -p "Are you sure want to create release $VERSION? (y/n) " ANSWER
case "$ANSWER" in
Y|y)
echo "Proceeding with creation of metpx-sarracenia release $VERSION ..."
sleep 2
break
;;
N|n)
echo "Ok. Exitting!"
exit 1
;;
*)
echo "Please answer 'y' or 'n'."
;;
esac
done
#echo "dch -v $VERSION"
dch -v $VERSION
# echo "git commit debian/changelog -m 'cutting new release $VERSION'"
git commit debian/changelog -m "cutting new sarra release $VERSION"
# echo "git tag -a v$VERSION -m 'release $VERSION'"
git tag -a v$VERSION -m "sarracenia release $VERSION"
read -e -p "Enter the name of the git remote that you would like to push to: [default=origin] " -i "origin" REMOTE
# echo "git push origin master"
# echo "git push origin --tags"
git push $REMOTE master
git push $REMOTE --tags
echo "Please remember to add '+' to the version string in __init__.py!"