-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfilter-flow-release-start-version
executable file
·46 lines (39 loc) · 1.34 KB
/
filter-flow-release-start-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
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
#
# Runs during git flow release start
#
# Positional arguments:
# $1 Version
#
# Return VERSION - When VERSION is returned empty, git-flow will stop as the
# version is necessary
#
# The following variables are available as they are exported by git-flow:
#
# MASTER_BRANCH - The branch defined as Master
# DEVELOP_BRANCH - The branch defined as Develop
#
VERSION=$1
# Implement your script here.
#
# Se modifica el comportamiento de Git Flow para lanzar releases. Forzamos para utilizar Semantic Version, de tal
# manera que en lugar de aceptar un nombre para la versión de la tag, únicamente aceptaremos los valores 'major',
# 'minor' y 'patch'.
#
# Si no viene por el parámetro VERSION ninguno de estos valores, devolveremos un mensaje con el prefijo 'ERROR',
# para capturarlo en el siguiente hook y cortar la ejecución.
#
# Obtenemos del repositorio remoto las últimas tags que coinciden con el patrón vX.Y.Z, y se calcula el número de
# versión siguiente en función de si es 'major', 'minor' o 'patch'. En caso de no existir ninguna tag, se parte
# de v0.0.0
SCRIPT_PATH=${0%/*}
FUNCTIONS="${SCRIPT_PATH}/inc/functions.sh"
if [ ! -f $FUNCTIONS ]; then
echo "\033[0;31m$FUNCTIONS not found.\033[0m"
exit 77
fi
source ${FUNCTIONS}
__is_valid_semver
__get_next_version
# To terminate the git-flow action, return a non-zero exit code.
exit 0