Skip to content

Commit d5817bc

Browse files
committed
New set-version script for creating releases
1 parent 8a84176 commit d5817bc

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

set-version

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
VERSION=$1
3+
[ -z "$VERSION" ] && exit 1
4+
OS=`uname`
5+
SED_ARG='-r'
6+
7+
if [ $OS == "Darwin" ]
8+
then
9+
SED_ARG='-E'
10+
fi
11+
12+
sed $SED_ARG "s/version = (.*)/version = \"$VERSION-1\"/;s/tag = (.*)/tag = \"v$VERSION\"/" rockspecs/elasticsearch.rockspec >rockspecs/elasticsearch-$VERSION-1.rockspec
13+
sed $SED_ARG "s/luarocks make (.*)/luarocks make rockspecs\/elasticsearch-$VERSION-1.rockspec/" .travis.yml >.travis.yml.tmp
14+
sed $SED_ARG "s/luarocks make (.*)/luarocks make rockspecs\/elasticsearch-$VERSION-1.rockspec/" tests/stress/.travis.yml >tests/stress/.travis.yml.tmp
15+
16+
if [ $? == 0 ]
17+
then
18+
mv .travis.yml.tmp .travis.yml
19+
mv tests/stress/.travis.yml.tmp tests/stress/.travis.yml
20+
git add rockspecs/elasticsearch-$VERSION-1.rockspec
21+
read -r -p "Do you want to tag this release in git? [y/N] " response
22+
if [[ $response =~ ^([yY])$ ]]
23+
then
24+
SIGN=""
25+
read -r -p "Do you want to sign the tag? [y/N] " response
26+
if [[ $response =~ ^([yY])$ ]]
27+
then
28+
SIGN="--sign"
29+
fi
30+
git add -u
31+
git commit -m "Set version $VERSION and tagged as v$VERSION"
32+
git tag -a v$VERSION -m "v$VERSION" $SIGN
33+
echo "Tagged this commit as v$VERSION"
34+
fi
35+
fi

0 commit comments

Comments
 (0)