-
Notifications
You must be signed in to change notification settings - Fork 0
/
incr_version.sh
executable file
·71 lines (47 loc) · 1.3 KB
/
incr_version.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
set -e
# Git check
(git diff --quiet && git diff --staged --quiet) || (
echo "Git not clean.. not continuing" >&2
exit 1)
# Calculate next version
version_line=$(sed -n '/^\s*\<VERSION\> [0-9]/p' CMakeLists.txt)
if [[ ! $version_line =~ ([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
echo "Couldn't find version string" >&2
exit 1
fi
major=${BASH_REMATCH[1]}
minor=${BASH_REMATCH[2]}
patch=${BASH_REMATCH[3]}
case "$1" in
major) ((++major)); minor=0; patch=0 ;;
minor) ((++minor)); patch=0 ;;
patch) ((++patch)) ;;
*) echo "Unknown version component '$1'"; exit 1 ;;
esac
new_version="$major.$minor.$patch"
echo "Next version: $new_version"
# Build check
./do.sh || (echo "Couldn't perform build" >&2; exit 1)
# Todos
todo() {
while true; do
echo "TODO: $1" [y]
read -r input
case "$input" in
y) return
esac
done
}
todo "Check ImGui version number & release"
todo "Check that this version is actually working"
todo "Beta components file up to date?"
todo "Main components file up to date?"
# Apply changes in repo
sed -i "s/^\(\s*\<VERSION\> \)[0-9.]*$/\1$new_version/" CMakeLists.txt
git add CMakeLists.txt
git commit -m "Release $new_version"
git tag "release-$new_version"
./do.sh
echo
echo git push origin HEAD --tags