Skip to content

Commit a73e686

Browse files
committed
update release version: better semantic pattern matching
1 parent 2a48efa commit a73e686

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/scripts/update-readme-version.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ fi
4747
ESCAPED_GROUP_ID=$(echo "$GROUP_ID" | sed 's/\./\\./g')
4848

4949
# Create the pattern to match
50-
PATTERN="\"$ESCAPED_GROUP_ID:$ARTIFACT_ID:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\""
50+
PATTERN="\"$ESCAPED_GROUP_ID:$ARTIFACT_ID:[0-9]+(\.[0-9]+){0,2}\""
5151

5252
# Create the replacement string
5353
REPLACEMENT="\"$GROUP_ID:$ARTIFACT_ID:$VERSION\""
5454

5555
# Check if the pattern exists in the file
56-
if ! grep -q "$GROUP_ID:$ARTIFACT_ID:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*" README.md; then
56+
if ! grep -Eq "$GROUP_ID:$ARTIFACT_ID:[0-9]+(\.[0-9]+){0,2}" README.md; then
5757
echo "Error: Dependency pattern not found in README.md"
5858
exit 1
5959
fi
6060

6161
# Perform the replacement and save to a temporary file
62-
sed "s|$PATTERN|$REPLACEMENT|g" README.md > README.md.tmp
62+
sed -E "s|$PATTERN|$REPLACEMENT|g" README.md > README.md.tmp
6363

6464
# Check if sed made any changes
6565
if cmp -s README.md README.md.tmp; then

0 commit comments

Comments
 (0)