-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·67 lines (42 loc) · 1.15 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
MESSAGE="$1"
STABLE="$2"
CURRENTDIR=`pwd`
MAINFILE="structured-data.php"
GITPATH="$CURRENTDIR"
echo
echo "Preparing for new version."
echo
STABLEVERSION=$(grep -w "Stable tag:" $GITPATH/readme.txt | awk '{print $3}')
echo "readme.txt stable version: $STABLEVERSION"
VERSION=$(grep -w "Version:" $GITPATH/$MAINFILE | awk '{print $3}')
echo
echo "$MAINFILE Version: $VERSION"
echo
if [ "$STABLEVERSION" != "$VERSION" ]; then echo "Version in readme.txt & $MAINFILE don't match. Exiting...."; exit 1; fi
if git show-ref --tags --quiet --verify -- "refs/tags/$VERSION"
then
echo "$VERSION already exists as git tag..";
exit 1;
else echo "Run git pipe."
fi
cd $GITPATH
git add .
echo
echo "-----------------------------------------------"
echo
echo -e "Enter a commit message for this version: \c"
read COMMITMSG
git commit -am"$COMMITMSG"
echo
echo "Tagging new version $VERSION in git"
echo
git tag v$VERSION
echo
echo "Pushing latest commit to origin with tags"
git push origin master
git push origin master --tags
echo
echo "Release: v$VERSION published"
echo
#sed -i -e "s/\(Version: \).*/\1$TAG/" $GITPATH/$MAINFILE