Newer
Older
web-services / bin / version-patch.sh
@Nicolas Thouvenin Nicolas Thouvenin on 21 Dec 649 bytes cleanup directory name parameter
#!/usr/bin/env bash

NAME_PACKAGE=$(basename $1)
LAST_VERSION=$(git tag | sort -n | grep "$NAME_PACKAGE" | tail -1)
MAJOR_VERSION=$(echo "$LAST_VERSION" | cut -d@ -f2 | cut -d\. -f1)
MINOR_VERSION=$(echo "$LAST_VERSION" | cut -d\. -f2)
PATCH_VERSION=$(echo "$LAST_VERSION" | cut -d\. -f3)

((NEW_PATCH_VERSION=${PATCH_VERSION:=-1}+1))
NEW_VERSION="${NAME_PACKAGE}@${MAJOR_VERSION:=0}.${MINOR_VERSION:=0}.${NEW_PATCH_VERSION:=0}"
git tag "${NEW_VERSION}" -m "${NEW_VERSION}"
git push --tags
echo "Nouvelle version créée: ${NEW_VERSION}"
echo "URL à utiliser: https://gitbucket.inist.fr/tdm/web-services/archive/${NAME_PACKAGE}/${NEW_VERSION}.zip"