Inlcude with rules is not working how I expect. What am I doing wrong or missed

Hi Community

Im trying to have my pipleline work that when someone uses the manual step and sees the VERSION pre-defined, they put in a version number (1.1.0) to deploy. That should kick off the prod-deploy.yml jobs. Otherwise, if VERSION is null or is an empty string, it does the non-prod deploy

But this seems to be not evaluating how I expected. Either, it does the non-prod part ok, but then when it comes to actually doing the manual pipleline build and putting in a value for VERSION, it still does part of the non-prod steps.

What have I missed or not understood about include rules and predefinded variables?


variables:
  VERSION:
    description: "Set the version number" # makes this variable appear on the Run Pipeline form



include:
  - local: nonprod-build-deploy.yml
    rules:
      - if: $VERSION == null || $VERSION == ""

  - local: prod-deploy.yml
    rules:
      - if: $VERSION && $VERSION =~ /.+/