forked from whyscream/dspam-milter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-release.sh
executable file
·31 lines (20 loc) · 956 Bytes
/
create-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
#!/bin/sh
# An automated way to create a new release
version=$1
branch=$2
test -z "$version" && echo "No version specified!" && exit 1
test -z "$branch" && echo "No branch specified!" && exit 1
if ! git checkout release; then
echo "Failed to switch to release branch" && exit 1
elif ! git merge --no-ff "$branch"; then
echo "Failed to merge branch '$branch' into 'release'" && exit 1
elif ! sed -i "s/^VERSION = '.*'$/VERSION = '$version'/" dspam/__init__.py; then
echo "Failed to set new version number in project" && exit 1
elif ! sed -i "s/version = '.*',$/version = '$version',/" setup.py; then
echo "Failed to set new version number in setup.py" && exit 1
elif ! git commit -m "Set version to $version" dspam/__init__.py setup.py; then
echo "Failed to commit new version" && exit 1
elif ! git tag -m "Release $version" "$version"; then
echo "Failed to tag new release" && exit 1
fi
echo "Created new tag for release '$version'"