Skip to content

Commit

Permalink
Added updated-datastax-license-version.sh to update datastax jar lice…
Browse files Browse the repository at this point in the history
…nses while releasing 3.1 automatically
  • Loading branch information
mukesh-ctds committed Sep 13, 2024
1 parent 9a24d90 commit 018824c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/update-datastax-license-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

if [ "$#" -ne 3 ]; then
echo "Usage: $0 <filename> <current_version> <new_version>"
exit 1
fi

FILENAME="$1"
CURRENT_VERSION="$2"
NEXT_VERSION="$3"

echo "$FILENAME"
echo "$CURRENT_VERSION"
echo "$NEXT_VERSION"

if [ ! -f "$FILENAME" ]; then
echo "Error: File '$FILENAME' not found!"
exit 1
fi

while IFS= read -r LINE; do
if [[ "$LINE" == *"$CURRENT_VERSION"* ]]; then
UPDATED_LINE="${LINE/$CURRENT_VERSION/$NEXT_VERSION}"
echo "$UPDATED_LINE"
else
echo "$LINE"
fi
done < "$FILENAME" > "$FILENAME.new"

mv "$FILENAME.new" "$FILENAME"
echo "License file '$FILENAME' updated successfully."

0 comments on commit 018824c

Please sign in to comment.