From baf04867647400862f582ea5e76142465e3b5a1d Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:03:33 -0400 Subject: [PATCH 1/3] Update update-versions.sh to handle CDP versions --- scripts/update-versions.sh | 41 ++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/scripts/update-versions.sh b/scripts/update-versions.sh index 735d053c2252..7c156f254e7e 100755 --- a/scripts/update-versions.sh +++ b/scripts/update-versions.sh @@ -1,9 +1,22 @@ -#!/bin/bash +#!/usr/bin/env bash -VERSION_STR="$1" -NEW_VERSION=$(echo "$VERSION_STR" | cut -d. -f2) -OLD_VERSION=$((NEW_VERSION - 1)) -NEXT_VERSION=$((NEW_VERSION + 1)) +if [[ -z "$1" || -z "$2" || -z "$3" || -z "$4" ]]; then + echo -e "fatal: too few args\n" + echo -e "usage:\n update-versions.sh " + echo -e "example:\n ./update-versions.sh 4.35 4.38 137 142" + exit 1 +fi + + +if [[ "$1" != *.*.* || "$2" != *.*.* ]] ; then + echo "fatal: use major.minor.minor version numbers (e.g.: 4.38.0)" + exit +fi + +OLD_VERSION="$1" +NEW_VERSION="$2" +OLD_CDP_VERSION="$3" +NEW_CDP_VERSION="$4" FILES=( "examples/java/build.gradle" @@ -13,20 +26,28 @@ FILES=( "examples/java/pom.xml" "examples/javascript/package.json" "examples/ruby/Gemfile" + "examples/ruby/spec/drivers/remote_webdriver_spec.rb" ) +# replace Selenium version for FILE_PATH in "${FILES[@]}"; do - if [[ "$FILE_PATH" == "examples/ruby/Gemfile" ]]; then - sed -i '' -E "s/4\.$NEW_VERSION\.0/4.$NEXT_VERSION.0/g" "$FILE_PATH" + echo $FILE_PATH + if [[ ! -f ${FILE_PATH} ]]; then + echo "can't find file for replacement!" fi - - sed -i '' -E "s/4\.$OLD_VERSION\.[0-9]+/4.$NEW_VERSION.0/g" "$FILE_PATH" + perl -i -pe "s/${OLD_VERSION}/${NEW_VERSION}/g" "${FILE_PATH}" done + +# replace CDP version +find ./examples -type f \ + '(' -name "*.cs" -o -name "*.java" -o -name "*.js" -o -name "*.py" -o -name "*.rb" ')' \ + -exec perl -i -pe "s/v${OLD_CDP_VERSION}/v${NEW_CDP_VERSION}/g" {} \; + pushd examples/ruby bundle install popd pushd examples/javascript npm install -popd \ No newline at end of file +popd From ea33c7212aab3ab72807cfc85b609b46d754ad76 Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:16:42 -0400 Subject: [PATCH 2/3] Fix usage --- scripts/update-versions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-versions.sh b/scripts/update-versions.sh index 7c156f254e7e..4b3e0e441028 100755 --- a/scripts/update-versions.sh +++ b/scripts/update-versions.sh @@ -3,7 +3,7 @@ if [[ -z "$1" || -z "$2" || -z "$3" || -z "$4" ]]; then echo -e "fatal: too few args\n" echo -e "usage:\n update-versions.sh " - echo -e "example:\n ./update-versions.sh 4.35 4.38 137 142" + echo -e "example:\n ./update-versions.sh 4.35.0 4.38.0 137 142" exit 1 fi From c5f1356798097d17898c1d0553fba28503b83d3d Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:21:59 -0400 Subject: [PATCH 3/3] Exit 1 on version format error --- scripts/update-versions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/update-versions.sh b/scripts/update-versions.sh index 4b3e0e441028..57555b927388 100755 --- a/scripts/update-versions.sh +++ b/scripts/update-versions.sh @@ -9,8 +9,8 @@ fi if [[ "$1" != *.*.* || "$2" != *.*.* ]] ; then - echo "fatal: use major.minor.minor version numbers (e.g.: 4.38.0)" - exit + echo "fatal: use major.minor.patch version numbers (e.g.: 4.38.0)" + exit 1 fi OLD_VERSION="$1"