только git reset --hard $(git describe --abbrev=0 --tags)
CI_COMMIT_TAG или CI_COMMIT_REF_NAME / CI_COMMIT_REF_SLUG
git describe в отдельную переменную?
- git checkout master
- git pull
- export TAG_TO_BUILD=$(git describe --abbrev=0 --tags)
- test -z "${TAG_TO_BUILD}" && echo "The TAG_TO_BUILD is empty" && exit 1
- git reset --hard
- docker login -u "$CI_REGISTRY_USER" -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build --pull -t "$CI_REGISTRY_IMAGE/$CI_PROJECT_NAME-$CI_COMMIT_REF_SLUG:${TAG_TO_BUILD}" .
- docker push "$CI_REGISTRY_IMAGE/$CI_PROJECT_NAME-$CI_COMMIT_REF_SLUG:${TAG_TO_BUILD}"