Gitlab only build for specific tag names

Magnus Lundberg picture Magnus Lundberg · Jun 29, 2017 · Viewed 20.5k times · Source

Are there any way to instruct the pipeline to only do a step for certain tags that matches a regex? I would like it to do a deploy when I push a tag on the format 1.2.3 (for example) are there any way to do this?

Answer

Jonas Geiregat picture Jonas Geiregat · Jul 26, 2018

This should only be run for refs that are not branches named matching the given regex.

   job:
      only:
        - /^(\d+\.)?(\d+\.)?(\*|\d+)$/
      except:
        - branches