-
Notifications
You must be signed in to change notification settings - Fork 1
/
make-release.sh
executable file
·49 lines (37 loc) · 1.04 KB
/
make-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
#!/bin/bash
set -e
set -o pipefail
ver=$1
if [ "$ver" == "" ]; then
echo "Usage: $0 version" >&2
exit 1
fi
if [ "$(echo "$ver" | egrep -c '^[0-9]+\.[0-9]+(.[0-9]+)?$')" != "1" ]; then
echo "Invalid version $ver" >&2
exit 1
fi
if [ "$(git symbolic-ref --short HEAD)" != "master" ]; then
echo "Currently checkout out branch must be 'master'" >&2
exit 1
fi
if [ $(git status --porcelain | wc -l) != 0 ]; then
echo "Working copy contains uncommitted changes" >&2
exit 1
fi
echo "Fetching latest version" >&2
git fetch origin
if [ $(git ls-remote --tags origin v$ver | wc -l) != 0 ]; then
echo "Version $ver already released (remote tag v$ver already exists)" >&2
exit 1
fi
echo "Updating ipoolseq-pipeline (setting version to $ver)" >&2
echo $ver > VERSION
echo "Comitting change" >&2
git add VERSION
git commit -m "Incremented version to $ver"
echo "Tagging as v$ver and latest" >&2
git tag -f v$ver
echo "Pushing to origin" >&2
git push origin master v$ver
echo "Updating 'latest' on origin" >&2
git push -f origin v$ver:refs/tags/latest-release