This commit is contained in:
Amine 2018-11-13 20:24:06 +01:00
parent 07d9ce1054
commit 82a8977c96
2 changed files with 30 additions and 5 deletions

View File

@ -1,17 +1,33 @@
#!/bin/bash
BASE_VERSION="1.7"
TODAYS_VERSION="1"
LAST_TAG=$(git tag -l | sort -V | tail -1)
VERSION="${BASE_VERSION//./}$(date '+%y%m%j')$TODAYS_VERSION"
INITIAL_VERSION="${BASE_VERSION//./}$(date '+%y%m%j')"
PARAMS_EXCEPT_PUBLISH=$(echo $1 | sed 's/\-\-publish//')
LAST_DAY_VERSION=$(echo $LAST_TAG | sed "s/v${INITIAL_VERSION}//")
LAST_DAY_VERSION_LENGTH=$(echo "${#LAST_DAY_VERSION}")
if [[ "$LAST_DAY_VERSION_LENGTH" == "1" ]]
then
TODAYS_VERSION=$(( $LAST_DAY_VERSION + 1 ))
else
TODAYS_VERSION="1"
fi
VERSION="${INITIAL_VERSION}${TODAYS_VERSION}"
PARAMS_EXCEPT_PUBLISH_LOCAL=$(echo $1 | sed 's/\-\-publish\-local//')
PARAMS_EXCEPT_PUBLISH=$(echo $PARAMS_EXCEPT_PUBLISH_LOCAL | sed 's/\-\-publish//')
./version.sh ${VERSION} ${PARAMS_EXCEPT_PUBLISH}
if [[ "$@" == *'--publish'* ]]
if [[ "$@" == *'--publish-local'* ]]
then
./publish-version-local.sh ${VERSION}
elif [[ "$@" == *'--publish'* ]]
then
./publish-version.sh ${VERSION}
else
echo "Did not publish. If you wanted to do so, call the script with \"--publish\"."
echo "Did not publish. If you wanted to do so, call the script with \"--publish\" or \"--publish-local\"."
fi

9
publish-version-local.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
rm -f version.txt
printf "versionName=$1-github\nversionCode=$1" >> version.txt
# You'll need to change server as your server and define a VERSION_PATH.
cp version.txt $VERSION_PATH
rm version.txt