From 52056ec892e0bda6dcb1ac0ff68511b67e9ecf70 Mon Sep 17 00:00:00 2001 From: David Seveloff Date: Thu, 5 Sep 2024 16:27:56 +0300 Subject: [PATCH] wip --- .github/workflows/env-vars-configure/action.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/env-vars-configure/action.yml b/.github/workflows/env-vars-configure/action.yml index 7fcd4c8c798..0cd7777651c 100644 --- a/.github/workflows/env-vars-configure/action.yml +++ b/.github/workflows/env-vars-configure/action.yml @@ -28,13 +28,23 @@ runs: # This command retrieves the latest tag that matches the specified channel and package version, # and extracts the version number from the tag name using awk. E.g. retrieves the number 7 from `3.11.0-cloud7`. # If inputs.POSTFIX == '-test', then get the latest prerelease version E.g, `3.11.0-cloud7-test` - echo "Getting the latest tag for the channel: ${{ inputs.CHANNEL }} and package version: ${{ env.CLEAN_PACKAGE_VERSION }}" + + CLEAN_VERSION_ESCAPED=$(echo "${{ env.CLEAN_PACKAGE_VERSION }}" | sed 's/\./\\./g') + echo "CLEAN_VERSION_ESCAPED=$CLEAN_VERSION_ESCAPED" + if [[ "${{ inputs.POSTFIX }}" == "-test" ]]; then - CURRENT_CHANNEL_VERSION=$(git ls-remote --tags | grep "\-test" | grep -v "refs/tags/v" | grep "${{ inputs.CHANNEL }}" | grep "${{ env.CLEAN_PACKAGE_VERSION }}" | tail -n1 | awk -F'${{ inputs.CHANNEL }}' '{print $2}' | awk -F'${{ inputs.POSTFIX }}' '{print $1}' || echo 0) + CURRENT_CHANNEL_VERSION=$(git ls-remote --tags | grep "\-test" | grep -v "refs/tags/v" | grep "${{ inputs.CHANNEL }}" | grep "$CLEAN_VERSION_ESCAPED" | tail -n1 | awk -F'${{ inputs.CHANNEL }}' '{print $2}' | awk -F'${{ inputs.POSTFIX }}' '{print $1}' || echo 0) else - CURRENT_CHANNEL_VERSION=$(git ls-remote --tags | grep -v "\-rc" | grep -v "\-test" | grep -v "refs/tags/v" | grep "${{ inputs.CHANNEL }}" | grep "${{ env.CLEAN_PACKAGE_VERSION }}" | tail -n1 | awk -F'${{ inputs.CHANNEL }}' '{print $2}' || echo 0) + CURRENT_CHANNEL_VERSION=$(git ls-remote --tags | grep -v "\-rc" | grep -v "\-test" | grep -v "refs/tags/v" | grep "${{ inputs.CHANNEL }}" | grep "$CLEAN_VERSION_ESCAPED" | tail -n1 | awk -F'${{ inputs.CHANNEL }}' '{print $2}' || echo 0) fi + echo "Getting the latest tag for the channel: ${{ inputs.CHANNEL }} and package version: ${{ env.CLEAN_PACKAGE_VERSION }}, CURRENT_CHANNEL_VERSION=$CURRENT_CHANNEL_VERSION" +# if [[ "${{ inputs.POSTFIX }}" == "-test" ]]; then +# CURRENT_CHANNEL_VERSION=$(git ls-remote --tags | grep "\-test" | grep -v "refs/tags/v" | grep "${{ inputs.CHANNEL }}" | grep "${{ env.CLEAN_PACKAGE_VERSION }}" | tail -n1 | awk -F'${{ inputs.CHANNEL }}' '{print $2}' | awk -F'${{ inputs.POSTFIX }}' '{print $1}' || echo 0) +# else +# CURRENT_CHANNEL_VERSION=$(git ls-remote --tags | grep -v "\-rc" | grep -v "\-test" | grep -v "refs/tags/v" | grep "${{ inputs.CHANNEL }}" | grep "${{ env.CLEAN_PACKAGE_VERSION }}" | tail -n1 | awk -F'${{ inputs.CHANNEL }}' '{print $2}' || echo 0) +# fi + # If value is not a number (e.g. empty string) then set it to 0 if ! [[ $CURRENT_CHANNEL_VERSION =~ ^[0-9]+$ ]]; then CURRENT_CHANNEL_VERSION=0