include gittag into yaml

This commit is contained in:
Marcel Märtens 2022-04-08 15:15:50 +02:00
parent 618d4b2340
commit 0c50d6fe24
2 changed files with 5 additions and 24 deletions

View File

@ -32,6 +32,8 @@ docker:
gittag:
extends: .publish
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule"
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG}
tags: ["veloren/veloren", "publish", "trusted"]
script:
@ -40,10 +42,9 @@ gittag:
- git config --global http.postBuffer 52428800
- git remote set-url origin https://veloren-bot:${GITLAB_TOKEN_WRITE}@${CI_PROJECT_URL:8}
- |
publishgittag PUBLISH_GIT_TAG
if [ "${PUBLISH_GIT_TAG}" != "" ]; then
git tag -a "${PUBLISH_GIT_TAG}" -m '' -f;
git push origin "${PUBLISH_GIT_TAG}" -f;
if [[ ! "${SCHEDULE_CADENCE}" =~ ${TAG_REGEX} ]]; then
git tag -a "${SCHEDULE_CADENCE}" -m '' -f;
git push origin "${SCHEDULE_CADENCE}" -f;
fi
pages:

View File

@ -26,24 +26,4 @@ if [[ ${CI_COMMIT_BRANCH} == ${CI_DEFAULT_BRANCH} ]]; then
VAR="master";
return 0;
fi
}
### returns respective GIT TAG
### release-tag => "" (releases already have a tag)
### schedule => <SCHEDULE_CADENCE> (e.g. nightly)
### master => "" (master doesn't need a tag)
### else => ""
publishgittag () {
local -n VAR=$1
if [[ -z "${SCHEDULE_CADENCE}" && ${CI_PIPELINE_SOURCE} == "schedule" ]]; then
VAR="${SCHEDULE_CADENCE}";
# sanitize check
if [[ "${SCHEDULE_CADENCE}" =~ ${TAG_REGEX} ]]; then
VAR="invalid_cadence";
else
VAR="${SCHEDULE_CADENCE}";
fi
return 0;
fi
VAR="";
}