From 23ff745627af57ce7c96abd9b599cc901ac2697c Mon Sep 17 00:00:00 2001 From: gabriel Date: Wed, 12 Sep 2018 15:33:32 +0200 Subject: [PATCH] correct before_script for nightly build versions - fix gitlab array of strings syntax error - get proper commit id - avoid colon in stings --- .gitlab-ci.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 45b4f0da67c..1929725ef5b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,17 +41,14 @@ cache: paths: - artifacts/ -.determine_version: - before_script: &determine_version - - > - VERSION="$(sed -r -n '1,/^version/s/^version = "([^"]+)".*$/\1/p' < Cargo.toml)"; - if [ "${CI_COMMIT_REF_NAME}" = "nightly" ]; then - COMMIT_REF_SHORT="$(echo ${CI_COMMIT_REF} | grep -oE '^.{7}')"; - DATE_STRING="$(date +%Y%m%d)"; - export VERSION="${VERSION}-${COMMIT_REF_SHORT}-${DATE_STRING}"; - fi; - export VERSION; - echo "Version: $VERSION" +.determine_version: &determine_version + - VERSION="$(sed -r -n '1,/^version/s/^version = "([^"]+)".*$/\1/p' Cargo.toml)" + - DATE_STR="$(date +%Y%m%d)" + - ID_SHORT="$(echo ${CI_COMMIT_SHA} | cut -c 1-7)" + - test "${CI_COMMIT_REF_NAME}" = "nightly" && VERSION="${VERSION}-${ID_SHORT}-${DATE_STR}" + - export VERSION + - echo "Version = ${VERSION}" + #### stage: test