@@ -54,6 +54,24 @@ if [ -n "${VENDOR}" ]; then
5454 echo " Setting packager: $VENDOR "
5555fi
5656
57+ function update_version {
58+ local tag=$1
59+ local major
60+ local minor
61+ local patch
62+
63+ # Extract major, minor, and patch from the tag
64+ # We need to make sure to remove the "v" prefix from the tag and any characters after the patch version
65+ tag=$( echo " $tag " | sed ' s/^v//g' | sed ' s/-.*//g' )
66+ major=$( echo " $tag " | cut -d. -f1)
67+ minor=$( echo " $tag " | cut -d. -f2)
68+ patch=$( echo " $tag " | cut -d. -f3)
69+
70+ echo " Major: $major , Minor: $minor , Patch: $patch "
71+
72+ " ${SCRIPTS_DIR} /update-version.sh" " $major " " $minor " " $patch "
73+ }
74+
5775function get_file_size {
5876 local file=" $1 "
5977 if [[ " $OSTYPE " == " darwin" * ]]; then
@@ -202,6 +220,23 @@ mkdir -p "$OUTPUT_DIR"
202220PKG_DIR=" $OUTPUT_DIR /$PACKAGE_NAME "
203221PACKAGE_ZIP=" $PACKAGE_NAME .zip"
204222
223+ echo " Updating version..."
224+ update_version " $RELEASE_TAG "
225+ git config --global github.user " github-actions[bot]"
226+ git config --global user.name " github-actions[bot]"
227+ git config --global user.email " 41898282+github-actions[bot]@users.noreply.github.com"
228+ git add .
229+
230+ # We should only commit if there are changes
231+ need_update_commit=true
232+ if git diff --cached --quiet; then
233+ echo " Version already updated"
234+ need_update_commit=false
235+ else
236+ echo " Creating version update commit..."
237+ git commit -m " change(version): Update core version to $RELEASE_TAG "
238+ fi
239+
205240echo " Updating submodules ..."
206241git -C " $GITHUB_WORKSPACE " submodule update --init --recursive > /dev/null 2>&1
207242
@@ -469,6 +504,17 @@ if [ "$RELEASE_PRE" == "false" ]; then
469504 echo
470505fi
471506
507+ if [ " $need_update_commit " == " true" ]; then
508+ echo " Pushing version update commit..."
509+ git push
510+ new_tag_commit=$( git rev-parse HEAD)
511+ echo " New commit: $new_tag_commit "
512+
513+ echo " Moving tag $RELEASE_TAG to $new_tag_commit ..."
514+ git tag -f " $RELEASE_TAG " " $new_tag_commit "
515+ git push --force origin " $RELEASE_TAG "
516+ fi
517+
472518set +e
473519
474520# #
0 commit comments