-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy path.pre-push
More file actions
executable file
·32 lines (26 loc) · 821 Bytes
/
.pre-push
File metadata and controls
executable file
·32 lines (26 loc) · 821 Bytes
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
# Update the Version number from the CHANGELOG.md file on:
# - VERSION
# - README.md
# get the version number
VERSION=`cat CHANGELOG.md | grep '##' | head -n 1 | awk '{print $2}' | tr -d '[]'`
FLAG=''
# get README version number and check if update is needed
RV=`cat README.md | grep '^# MailAD v' | awk '{print $3}'`
if [ "$VERSION" != "$RV" ] ; then
sed s/'^# MailAD.*'/"# MailAD ${VERSION}"/ -i README.md
FLAG='1'
fi
# get VERSION number and check if update is needed
VV=`cat VERSION`
if [ "$VERSION" != "$VV" ] ; then
echo ${VERSION} > VERSION
FLAG='1'
fi
if [ "$FLAG" ] ; then
echo "ERROR!: Missmatch on the version found!"
echo "I did fixit & commited the change, push it again please..."
git commit -m "AutoUpdate version number" VERSION README.md
exit 1
fi
exit 0