31 lines
1.2 KiB
YAML
31 lines
1.2 KiB
YAML
## A set of predefined rules to use on the different jobs
|
|
.default-rules:
|
|
# Rules to run the job only on the master branch
|
|
run-on-master:
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
when: always
|
|
- when: never
|
|
# Rules to run the job only on branches that are not master. This is needed because for now
|
|
# we need to keep a similar behavior due to the integration with teamcity, which requires us
|
|
# to not trigger pipelines on tags and/or merge requests.
|
|
run-on-branch:
|
|
- if: $CI_COMMIT_TAG
|
|
when: never
|
|
- if: $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
|
|
when: always
|
|
- when: never
|
|
|
|
# This before_script is injected into every job that runs on master meaning that if there is no tag the step
|
|
# will succeed but only write "No tag present - Skipping" to the console.
|
|
.check-tag:
|
|
before_script:
|
|
- |
|
|
# Check if there is a Git tag pointing to HEAD
|
|
echo "Tag found: $(git tag --points-at HEAD | grep .)"
|
|
if git tag --points-at HEAD | grep .; then
|
|
echo "Tag found: $(git tag --points-at HEAD | grep .)"
|
|
export "VERSION=$(git tag --points-at HEAD | grep .)"
|
|
else
|
|
echo "No tag present — skipping."
|
|
exit 0
|
|
fi |