From b743cc69aa47c2e0eb60b0170b1268273f2c664e Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Sat, 17 Mar 2018 19:13:12 +0300 Subject: [PATCH] Remove version definition from the application and pass it on build time --- .gitlab-ci.yml | 14 +++++++++++++- common/config/config.php | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5d8220e..30dddad 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -61,10 +61,22 @@ test:frontend: build:production: image: docker:latest stage: build + variables: + GA_ID: "UA-45299905-3" + SENTRY_CDN: "https://088e7718236a4f91937a81fb319a93f6@sentry.ely.by/2" before_script: - docker login -u gitlab-ci -p $CI_BUILD_TOKEN registry.ely.by + - export VERSION="${CI_COMMIT_TAG:-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA:0:7}}" - echo "$SSH_PRIVATE_KEY" > id_rsa - - echo "$FRONTEND_ENV_CONFIG" > frontend/config/env.js + - | + echo " + module.exports = { + version: '$VERSION', + ga: {id: '$GA_ID'}, + sentryCdn: "$SENTRY_CDN", + }; + " > frontend/config/env.js + - sed -i '' -e 's/{{PLACE_VERSION_HERE}}/$VERSION/g' common/config/config.php script: - export IMAGE_NAME="$CONTAINER_IMAGE:latest" - docker build --pull -t $IMAGE_NAME . diff --git a/common/config/config.php b/common/config/config.php index 54d1680..c8f3632 100644 --- a/common/config/config.php +++ b/common/config/config.php @@ -1,6 +1,6 @@ '1.1.25-dev', + 'version' => '{{PLACE_VERSION_HERE}}', // This will be replaced by build tool 'vendorPath' => dirname(__DIR__, 2) . '/vendor', 'components' => [ 'cache' => [