forked from BTrDB/btrdb-python
-
Notifications
You must be signed in to change notification settings - Fork 2
/
release.sh
executable file
·46 lines (38 loc) · 973 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
#!/bin/bash
set -e
# helper function used to promot the user for how they would like to proceed
function checkYN {
while true
do
read -p "$1 (Y/N): " action
case $action in
n|N|no)
return 1
;;
y|Y|yes)
return 0
;;
*)
echo "type Y or N"
;;
esac
done
}
if [[ "$1" == "" ]]
then
echo "Missing version e.g 5 11 2"
echo -e "\nUsage:\n ./release.sh 5 11 2 \n"
exit 1
fi
if ! checkYN "Add new release 'v$1.$2.$3'?"; then
echo exiting
exit 1
fi
echo "Setting version to v$1.$2.$3"
VERSION_CODE="__version_info__ = {\"major\": $1, \"minor\": $2, \"micro\": $3, \"releaselevel\": \"final\"}"
sed -i.bak "s/^__version_info__.*$/${VERSION_CODE}/g" btrdb/version.py
sed -i.bak "s/^version.*$/version\ = \"$1.$2.$3\"/g" pyproject.toml
git add btrdb/version.py
git add pyproject.toml
git commit -m "Release v$1.$2.$3"
echo "Now make a PR and merge it into main, then make tag :)"