iOS: Auto increment build number issue in CI/CD using Github action yaml file

I am facing an issue in incrementing the build number automatically. All scripts are working fine but the script for auto-increment build number is not incrementing.

        id: increment_build
        run: |
          # Fetch current build number from your project
          CURRENT_BUILD_NUMBER=$(xcrun agvtool what-version -terse)

          # Output the current build number
          echo "Current build number is: $CURRENT_BUILD_NUMBER"

          # Increment build number
          NEW_BUILD_NUMBER=$((CURRENT_BUILD_NUMBER + 1))

          # Output the new build number
          echo "::set-output name=new_build_number::$NEW_BUILD_NUMBER"

      - name: Set build number
        run: |
          INFO_PLIST="Info.plist"
          NEW_BUILD_NUMBER="${{ steps.increment_build.outputs.new_build_number }}"

          # Check if CFBundleVersion entry exists, create it if it doesn't
          if /usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$INFO_PLIST" >/dev/null 2>&1; then
            /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $NEW_BUILD_NUMBER" "$INFO_PLIST"
          else
            /usr/libexec/PlistBuddy -c "Add :CFBundleVersion string $NEW_BUILD_NUMBER" "$INFO_PLIST"
         fi

I have 3 env's in my project for which I have created 3 .xconfig files for keeping the config separately. In build setting, I have used $(APP_BUILD) for APP_Build under the User-Defined section.

iOS: Auto increment build number issue in CI/CD using Github action yaml file
 
 
Q