1
0
mirror of https://github.com/ovh/php-ovh.git synced 2023-11-05 03:20:26 +01:00
php-ovh/scripts/bump-version.sh
Jean-Tiare Le Bigot 3ebf59eefb add bump-version helper. See #37
Signed-off-by: Jean-Tiare Le Bigot <jt@yadutaf.fr>
2016-03-28 23:44:35 +02:00

20 lines
710 B
Bash

#!/bin/bash
#
# Usage: ./scripts/bump-version.sh <new.version.number>
#
PCRE_MATCH_VERSION="[0-9]+\.[0-9]+\.[0-9]+"
PCRE_MATCH_VERSION_BOUNDS="(^|[- v/'\"])${PCRE_MATCH_VERSION}([- /'\"]|$)"
VERSION="$1"
if ! echo "$VERSION" | grep -Pq "${PCRE_MATCH_VERSION}"; then
echo "Usage: ./scripts/bump-version.sh <new.version.number>"
echo " <new.version.number> must be a valid 3 digit version number"
echo " Make sure to double check 'git diff' before commiting anything you'll regret on master"
exit 1
fi
# Edit text files matching the PCRE, do *not* patch .git folder
grep -PIrl "${PCRE_MATCH_VERSION_BOUNDS}" $(ls) | xargs sed -ir "s/${PCRE_MATCH_VERSION_BOUNDS}/"'\1'"${VERSION}"'\2/g'