ReaderForSelfoss-multiplatform/build.sh
Amine Louveau f4db02521d
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
drone-sign (#57)
## Types of changes

- [ ] I have read the **CONTRIBUTING** document.
- [ ] My code follows the code style of this project.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [ ] This is **NOT** translation related.

This closes issue #XXX

This is implements feature #YYY

This finishes chore #ZZZ

Co-authored-by: aminecmi <aminecmi@gmail.com>
Reviewed-on: https://gitea.amine-louveau.fr/Louvorg/ReaderForSelfoss-multiplatform/pulls/57
2022-09-14 10:32:00 +00:00

32 lines
754 B
Bash
Executable File

#!/bin/bash
git fetch --tags -p
BASE_VERSION="1"
LAST_TAG=$(git tag -l | sort -V | tail -1)
INITIAL_VERSION="${BASE_VERSION//./}$(date '+%y%m%j')"
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=$(echo $1 | sed 's/\-\-publish//')
./version.sh ${VERSION} ${PARAMS_EXCEPT_PUBLISH} $@
if [[ "$@" == *'--publish'* ]]
then
./publish-version.sh ${VERSION} $@
else
echo "Did not publish. If you wanted to do so, call the script with \"--publish\" or \"--publish-local\"."
fi