forked from SparkyBluefang/S4E
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease
executable file
·91 lines (80 loc) · 1.89 KB
/
release
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
#!/bin/sh
# ***** BEGIN LICENSE BLOCK *****
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011, 2013 Matthew Turnbull <sparky@bluefang-logic.com>. All Rights Reserved.
#
# ***** END LICENSE BLOCK *****
TS=`date +%Y.%m.%d.%H`
VERSION=""
RELEASE=""
FORCE=""
usage() {
echo "Options:"
echo " -a --alpha Alpha version bump"
echo " -b --beta Beta release"
echo " -p --pre Pre version bump"
echo " -r --release Final release"
echo " -f --force Continue even with uncommitted changes (alpha/pre only)"
echo " -h --help Print this help message"
echo ""
echo "Version bumps will just modify the install.manifest and commit the changes. Releases will also modify the ChangeLog and tag the commit."
exit $1
}
while [ -n "$1" ]; do
case "$1" in
-a|--alpha)
VERSION="${TS}a"
;;
-b|--beta)
VERSION="${TS}b"
RELEASE="1"
;;
-p|--pre)
VERSION="${TS}pre"
;;
-r|--release)
VERSION="${TS}"
RELEASE="1"
;;
-f|--force)
FORCE="1"
;;
-h|--help)
usage 0
;;
default)
echo "Invalid action: '$1'"
usage 1
;;
esac
shift
done
if [ -z "$VERSION" ]; then
usage 1
fi
# Check for uncommitted changes
CHANGES=`git diff HEAD --exit-code --name-only`
if [ $? -ne 0 ] && ( [ -n "$RELEASE" ] || [ -z "$FORCE" ] ); then
echo "There are uncommitted changes:"
echo "${CHANGES}"
exit 1
fi
# Up the version
sed -i "/^version=/s/=.*$/=${VERSION}/g" install.manifest
git add install.manifest
if [ -n "${RELEASE}" ]; then
# Update the ChangeLog
sed -i "/^Version /s/ next$/ next\n\nVersion ${VERSION}/g" ChangeLog
git add ChangeLog
# Commit and tag the release
git commit -m "Release ${VERSION}"
git tag "${VERSION}"
git push --tags
else
# Commit
git commit -m "Version bump ${VERSION}"
fi