-
Notifications
You must be signed in to change notification settings - Fork 38
/
set-version
executable file
·35 lines (32 loc) · 1.15 KB
/
set-version
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
#!/usr/bin/env bash
VERSION=$1
[ -z "$VERSION" ] && exit 1
OS=`uname`
SED_ARG='-r'
if [ $OS == "Darwin" ]
then
SED_ARG='-E'
fi
sed $SED_ARG "s/version = (.*)/version = \"$VERSION-1\"/;s/tag = (.*)/tag = \"v$VERSION\"/" rockspecs/elasticsearch.rockspec >rockspecs/elasticsearch-$VERSION-1.rockspec
sed $SED_ARG "s/luarocks make (.*)/luarocks make rockspecs\/elasticsearch-$VERSION-1.rockspec/" .travis.yml >.travis.yml.tmp
sed $SED_ARG "s/luarocks make (.*)/luarocks make rockspecs\/elasticsearch-$VERSION-1.rockspec/" tests/stress/.travis.yml >tests/stress/.travis.yml.tmp
if [ $? == 0 ]
then
mv .travis.yml.tmp .travis.yml
mv tests/stress/.travis.yml.tmp tests/stress/.travis.yml
git add rockspecs/elasticsearch-$VERSION-1.rockspec
read -r -p "Do you want to tag this release in git? [y/N] " response
if [[ $response =~ ^([yY])$ ]]
then
SIGN=""
read -r -p "Do you want to sign the tag? [y/N] " response
if [[ $response =~ ^([yY])$ ]]
then
SIGN="--sign"
fi
git add -u
git commit -m "Set version $VERSION and tagged as v$VERSION"
git tag -a v$VERSION -m "v$VERSION" $SIGN
echo "Tagged this commit as v$VERSION"
fi
fi