'How to run Fastlane pipeline for feature branches?

This is what I define in gitlab-ci.yml file:

build:

  stage: build

  script:
    - bundle exec pod repo update
    - bundle exec pod install || bundle exec pod install --repo-update
    - bundle exec fastlane build

  when: always

  only:
    - feature/* #when I change this to - feature/swd/fastlane then it works.

  tags:
    - iOS

but this doesn't work.

The following branches should start the pipeline:

feature/swd/fastlane, feature/swd/245...



Solution 1:[1]

When using a regex for only you need use delimiters (Sample in documentation).

So you have to write:

only:
  - /feature\/*/

Where / at the beginning and at the end are used as delimiters and the path separator / needs to be escaped with a back slash \.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sascha Frinken