How to trigger a GitLab CICD pipeline whenever a tag like below gets created? How can I make it in regular expression for all future tags based on the same format?
Tag to trigger the pipeline: 2021.08.31.DEVRELEASE.0001
Where DEVRELEASE
is the static keyword, rest of the keywords would change.
You can use rules
and if
keywords to define your tag's regex. You can use the following snippet and customize the regex to match your desired tag:
publish:
stage: publish
image: ...
script:
- ...
rules:
# Runs only when a tag with 'X.Y.Z.DEVRELEASE.A' pattern is created
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+\.DEVRELEASE\.\d+$/'