-
Notifications
You must be signed in to change notification settings - Fork 12
/
prepare-release.sh
54 lines (43 loc) · 1.09 KB
/
prepare-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
#!/bin/sh
set -e
err() {
for e in "$@"; do
echo "$e" >&2
done
exit 1
}
usage() {
err "$@" "usage: ${0##*/} tag [savepath]"
}
test $# -gt 0 || usage
test $# -le 2 || usage
tag=$1; shift
echo "$tag" | egrep -q '^v[0-9]+\.[0-9]+\.[0-9]+$' ||
err "invalid tag name, must be like v1.2.3"
arc_path=${1:-/tmp}
v=${tag#v}
arc_name=tlc-${v}.tar.gz
test -f CHANGES || err "${0##*/} must be called from source root"
! grep -Fqx "HEAD" CHANGES || err "CHANGES must not contain HEAD section"
grep -Fqx "v.$v" CHANGES || err "CHANGES lacks $v section"
git branch | grep -Fqx '* master' || err "not on master branch"
if git tag | fgrep -qx "$tag"; then
echo "tag $tag is already there, skipping it's creation"
else
if git status -s CHANGES | grep 'M CHANGES'; then
git ci CHANGES -m "version $v"
git push origin
fi
git tag "$tag"
git push origin "$tag"
fi
make clean clean-test
pax -wzv \
-s ',^\./.git.*,,' \
-s ',^\./obj\(/.*\)*$,,' \
-s ',^\./build.*,,' \
-s ",^./${0##*/}\$,," \
-s ',^.*db.conf,,' \
-s "/^./tlc-${v}/" \
. >"$arc_path/$arc_name"
echo "archive saved to $arc_path/$arc_name"