From f2f1e0ab33a2614d23ed2cf0c236a46fc5057f9c Mon Sep 17 00:00:00 2001 From: Allan Blanchard <allan.blanchard@cea.fr> Date: Fri, 5 Aug 2022 10:15:39 +0200 Subject: [PATCH] [ci] add checks before publish or release --- .gitlab-ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7e1d85ac7b7..39bd777603e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -54,6 +54,28 @@ do-not-stop-pipeline: variables: - $DEFAULT == $CI_COMMIT_BRANCH +check-publish: + stage: prepare + script: > + [[ "$RELEASE" == "no" ]] && + [[ "$DEFAULT" == "$CI_COMMIT_BRANCH" ]] && + [[ "$DEFAULT" == "master" ]] + only: + variables: + - $PUBLISH == "yes" + +check-release: + stage: prepare + script: > + [[ "$PUBLISH" == "no" ]] && + [[ "$DEFAULT" == "$CI_COMMIT_BRANCH" ]] && + [[ "$DEFAULT" == "stable/$(cat VERSION_CODENAME | tr '[:upper:]' '[:lower:]')" ]] && + [[ "$(git describe --tag)" == "$(cat VERSION | sed 's/~/-/')" ]] + [[ "$(cat VERSION)" == "$(cat opam/opam | grep "^version" | sed 's/version: \"\(.*\)\"/\1/')" ]] + only: + variables: + - $RELEASE == "yes" + ################################################################################ ### BUILD -- GitLab