11cb0ef41Sopenharmony_ci#!/bin/sh
21cb0ef41Sopenharmony_ciset -e
31cb0ef41Sopenharmony_ci# Shell script to update v8 patch update
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ciBASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_cicd "$BASE_DIR"
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciIS_UP_TO_DATE=$(git node v8 minor | grep "V8 is up-to-date")
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciif [ -n "$IS_UP_TO_DATE" ]; then
121cb0ef41Sopenharmony_ci  echo "Skipped because V8 is on the latest version."
131cb0ef41Sopenharmony_ci  exit 0
141cb0ef41Sopenharmony_cifi
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciDEPS_DIR="$BASE_DIR/deps"
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ciCURRENT_MAJOR_VERSION=$(grep "#define V8_MAJOR_VERSION" "$DEPS_DIR/v8/include/v8-version.h" | cut -d ' ' -f3)
191cb0ef41Sopenharmony_ciCURRENT_MINOR_VERSION=$(grep "#define V8_MINOR_VERSION" "$DEPS_DIR/v8/include/v8-version.h" | cut -d ' ' -f3)
201cb0ef41Sopenharmony_ciCURRENT_BUILD_VERSION=$(grep "#define V8_BUILD_NUMBER" "$DEPS_DIR/v8/include/v8-version.h" | cut -d ' ' -f3)
211cb0ef41Sopenharmony_ciCURRENT_PATCH_VERSION=$(grep "#define V8_PATCH_LEVEL" "$DEPS_DIR/v8/include/v8-version.h" | cut -d ' ' -f3)
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ciNEW_VERSION="$CURRENT_MAJOR_VERSION.$CURRENT_MINOR_VERSION.$CURRENT_BUILD_VERSION.$CURRENT_PATCH_VERSION"
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ciecho "All done!"
261cb0ef41Sopenharmony_ciecho ""
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_ci# The last line of the script should always print the new version,
291cb0ef41Sopenharmony_ci# as we need to add it to $GITHUB_ENV variable.
301cb0ef41Sopenharmony_ciecho "NEW_VERSION=$NEW_VERSION"
31