-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrelease.sh
executable file
·47 lines (34 loc) · 868 Bytes
/
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
#!/bin/sh
set -e
usage() {
printf 'Usage: %s (major|minor|patch) \n' "$0"
exit 1
}
if [ $# -ne 1 ]; then
usage
fi
set -eu
desc=$(git describe --dirty --abbrev=0)
case $desc in
*dirty*) printf 'Dirty working tree, commit your changes first!\n' >&2; exit 1;;
esac
desc="${desc#v}"
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
printf 'Untracked files, commit your changes first!\n' >&2
exit 1
fi
IFS=. read -r major minor patch <<EOF
$(printf '%s\n' "$desc")
EOF
prev=$major.$minor.$patch
case $1 in
major) major=$((major+1)); minor=0; patch=0;;
minor) minor=$((minor+1)); patch=0;;
patch) patch=$((patch+1));;
*) usage;;
esac
version=$major.$minor.$patch
sed -i "s/\"version\": \"$prev\"/\"version\": \"$version\"/" manifest.json
git commit -m "Release v$version" manifest.json
git tag -a v$version -m "mute-tab $version"
make -B