forked from gabrielfalcao/HTTPretty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.release
executable file
·32 lines (23 loc) · 920 Bytes
/
.release
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
#!/bin/bash
declare newversion
declare current_version
declare sure
current_version="$(grep -E version ./httpretty/version.py | sed 's,version *= *.\(\([0-9]*[.]*\)\{3\,4\}\).,\1,g')"
echo -en "The current version is \033[1;33m$current_version\033[0m, type a new one\n\033[1;32mnew version:\033[0m "
read -r newversion
function find_files () {
find . -name 'README.rst' -or -name version.py -or -name conf.py
}
function update_files (){
find_files | xargs gsed -i "s,$current_version,$newversion,g"
}
echo -en "\033[A\033[A\rI will make a new commit named \033[1;33m'New release $newversion'\033[0m\n"
echo -en "Are you sure? [\033[1;32myes\033[0m or \033[1;31mno\033[0m]\n"
read -r sure
if [ "${sure}" == "yes" ]; then
update_files
echo -en "New release: \033[1;32m$newversion\033[0m\n"
git add "$(find_files)"
git commit -am "New release: $newversion"
git tag "${newversion}"
fi;