-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitnewversion.sh
executable file
·52 lines (41 loc) · 1.13 KB
/
gitnewversion.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
#!/bin/sh
command -v git >/dev/null 2>&1 || { echo "gitnewversion requires git but it is not installed. Aborting." >&2; exit 1; }
filecheck="gitpull.sh"
if [ -f "$filecheck" ]; then
if [ $# -eq 1 ]; then
if git show-ref --tags $1 ; then
echo Version $1 already committed
exit
fi
if git ls-remote --exit-code --tags origin $1 ; then
echo Version $1 already committed on origin
exit
fi
make cleanall
echo ' '
echo 'Calling git status to check what changes will be pushed..'
echo ' '
git status
echo ' '
echo -n "Add these changes in new version $1 on github? (y/N)"
read answer
if [ "$answer" != "${answer#[Yy]}" ] ;then
echo Yes
else
echo No
exit 1
fi
echo 'setting new version in src/version.hh'
echo '#define VERSION "'"$1"'"' > src/version.hh
echo 'Committing and pushing files to github..'
git add -A .
git commit -a -m "$1"
git tag -d $1 > /dev/null 2>&1
git tag -a $1 -m "$1"
git push --tags origin master
else
echo "gitnewversion.sh needs one argument: the new version string"
fi
else
echo "gitnewversion.sh must be run from the NODPLOT main directory."
fi