这是.gitlab-ci.yml
中的一个阶段:
check:
stage: check
script:
- echo "Checking if commit tag is valid"
- [[ $CI_COMMIT_TAG =~ ^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$ ]] && echo "Git commit tag valid" || echo "Git commit tag not valid" && exit 1
only:
- tags
当linting它时我得到错误:
Status: syntax is incorrect
Error: (<unknown>): did not find expected alphabetic or numeric character while scanning an alias at line 16 column 107
第16行是正则表达式行。