Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
davseve committed Sep 5, 2024
1 parent 3be53e6 commit 52056ec
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/env-vars-configure/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 52056ec

Please sign in to comment.