forked from DhavalKapil/elasticsearch-lua
-
Notifications
You must be signed in to change notification settings - Fork 6
/
set-version
executable file
·33 lines (30 loc) · 1.04 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
#!/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-lua.rockspec >rockspecs/elasticsearch-lua-$VERSION-1.rockspec
sed $SED_ARG "s/luarocks make (.*)/luarocks make rockspecs\/elasticsearch-lua-$VERSION-1.rockspec/" .github/workflows/test-all.yml >.github/workflows/test-all.yml.tmp
if [ $? == 0 ]
then
mv .github/workflows/test-all.yml.tmp .github/workflows/test-all.yml
git add rockspecs/elasticsearch-lua-$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