diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dd40faec9..9e29fa193 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -372,7 +372,7 @@ build_api: script: - rm -rf api/tests - > - if [[ "$CI_COMMIT_REF_NAME" =~ ^develop|stable$ ]]; then + if [[ -z "$CI_COMMIT_TAG" ]]; then ./scripts/set-api-build-metadata.sh $CI_COMMIT_SHORT_SHA; fi artifacts: @@ -425,7 +425,7 @@ deploy_docs: before_script: - docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD - > - if [[ "$CI_COMMIT_REF_NAME" =~ ^develop|stable$ ]]; then + if [[ -z "$CI_COMMIT_TAG" ]]; then ./scripts/set-api-build-metadata.sh $CI_COMMIT_SHORT_SHA; fi cache: diff --git a/scripts/set-api-build-metadata.sh b/scripts/set-api-build-metadata.sh index 5c62f8756..ef3a6341e 100755 --- a/scripts/set-api-build-metadata.sh +++ b/scripts/set-api-build-metadata.sh @@ -10,8 +10,12 @@ error() { exit 1 } +command -v git > /dev/null || error "git command not found!" command -v poetry > /dev/null || error "poetry command not found!" +# We assume this script only runs in a git repository +cd "$(git rev-parse --show-toplevel)/api" + COMMIT_SHA="$1" CURRENT_VERSION="$(poetry version --short)"