File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22# Get latest git tag
33latest_tag=$( git describe --tags --abbrev=0)
4- version_from_tag=$( echo " $latest_tag " | grep -o -E ' [0-9]+\.[0-9]+\.[0-9]+' )
4+ latest_tag_without_v=${latest_tag# " v" }
5+ version_from_tag=$( echo " $latest_tag_without_v " | grep -P ' ^(?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-]+)*))?$' )
56
67# Get the version from package.json
78version=$( jq -r ' .version' package.json)
89
9- echo " Latest tag: $latest_tag "
10+ echo " Latest tag: $latest_tag_without_v "
1011echo " Version from tag: $version_from_tag "
1112echo " Version from package.json: $version "
1213
@@ -15,3 +16,5 @@ if [ "$version" != "$version_from_tag" ]; then
1516 echo " Version in package.json and tag are not the same"
1617 exit 1
1718fi
19+
20+ echo " Version in package.json and tag are the same"
You can’t perform that action at this time.
0 commit comments