Skip to content

Commit

Permalink
README version update script fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
morisil committed Jan 6, 2025
1 parent fa75f0d commit 0126441
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/scripts/update-readme-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ fi
ESCAPED_GROUP_ID=$(echo "$GROUP_ID" | sed 's/\./\\./g')

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

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

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

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

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

0 comments on commit 0126441

Please sign in to comment.