mirror of
https://github.com/reecetech/version-increment.git
synced 2025-12-21 06:25:44 +00:00
Update action to support with tag_prefix parameter
This commit is contained in:
15
shared.sh
15
shared.sh
@@ -11,7 +11,11 @@ export LC_ALL=C.UTF-8
|
||||
|
||||
pcre_semver='^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$'
|
||||
pcre_master_ver='^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$'
|
||||
pcre_allow_vprefix="^v{0,1}${pcre_master_ver:1}"
|
||||
|
||||
# Extended regex to allow arbitrary prefixes before the semver
|
||||
pcre_allow_prefix='^.*(?P<semver>'"${pcre_master_ver:1}"')$'
|
||||
|
||||
pcre_allow_vprefix="^v{0,1}${pcre_allow_prefix:1}"
|
||||
pcre_old_calver='^(?P<major>0|[1-9]\d*)-0{0,1}(?P<minor>0|[0-9]\d*)-R(?P<patch>0|[1-9]\d*)$'
|
||||
|
||||
##==----------------------------------------------------------------------------
|
||||
@@ -51,6 +55,15 @@ if [[ "${use_api}" == 'true' ]] ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if the tag_prefix is set, and if not, set it to an empty string
|
||||
tag_prefix="${tag_prefix:-}"
|
||||
|
||||
# Add a trailing @ to tag_prefix if it doesn't already end with one
|
||||
if [[ -n "$tag_prefix" && "${tag_prefix: -1}" != "@" ]]; then
|
||||
tag_prefix="${tag_prefix}@"
|
||||
fi
|
||||
|
||||
|
||||
##==----------------------------------------------------------------------------
|
||||
## MacOS compatibility
|
||||
|
||||
|
||||
Reference in New Issue
Block a user