What's the right way to map git branches to kubernetes namespaces?

I want to associate git branches to kubernetes namespaces, for my Gitlab CI pipeline to deploy helm charts to the right namespaces, based on the branch. For example:

master branch  -> prd namespace
devel branch   -> dev namespace

How and Where do I map branches to namespaces?

I tried a simple bash if in the CI script and Gitlab CI variables. Both work but both are kludges. I’d like to know what the correct, non-“makeshift” way to do something like this is.

Someone knowledgeable suggested to use a helm values file for each namespace like values_prd.yaml/values_dev.yaml (I believe what they meant was to use a values file for each branch, values_master.yaml/values_devel.yaml) but neither option makes sense to me right now, as I don’t believe you can’t tell helm what namespace to install charts to by passing values
(can you?).

Here’s my .gitlab-ci.yml