Dynamically set pipeline variable based on set of conditions (Gitlab 13.0.6)

We are using Gitlab v13.0.6-ee (and in this release we cannot conditionally set pipeline variable like here: Keyword reference for the `.gitlab-ci.yml` file | GitLab )
We cannot upgrade Gitlab at the moment and looking for a workaround and be able to dynamically set pipeline variable based on set of conditions.
Does anybody have any idea how to accomplish this ?