Script problem in gitlab CI

Hi,

I’m trying to make this script works in GITLAB CI :

script:
- [[ "CI_COMMIT_MESSAGE" =~ \s-\sdeploy(-dev)?\s(.+) ]]
- npm run build “${BASH_REMATCH[2]}”

I tried every escape form i can think about, double quote, simple quote, escaping [[ with antislashes,
around every part of this script.

And i can’t manage to make it work, i know its just an escaping problem, but i don’t know what to do know : using something else than [[ because of yaml ??

I just want to apply my regex to commit message with [] in order to use bash_rematch to make a partial build.

Thank you very much for your help