Long time passed since the question I have posted here. I solved it back then by adding the configuration in rules section below
rules:
- if: $CI_COMMIT_REF_NAME =~ /^release\/\d+\.\d+\.\d+$/ && $CI_COMMIT_BEFORE_SHA == "0000000000000000000000000000000000000000"
when: always
- if: $CI_COMMIT_REF_NAME =~ /^release\/\d+\.\d+\.\d+$/
when: always
Now the CI will be triggered when new branch is pushed.
This two ifs can be combined.
rules:
- if: $CI_COMMIT_REF_NAME =~ /^release\/\d+\.\d+\.\d+$/ && $CI_COMMIT_BEFORE_SHA == "0000000000000000000000000000000000000000" || $CI_COMMIT_REF_NAME =~ /^release\/\d+\.\d+\.\d+$/
when: always
This should resolve the problem.
BTW I could find a video in youtube describing my exact issue.
Here is the link --> https://www.youtube.com/watch?v=77Q0xykWzOI&ab_channel=vlogize