From 08b5af751118069364e56e32c7d3c5561fbfb9a8 Mon Sep 17 00:00:00 2001 From: Romain Thouvenin Date: Tue, 2 Apr 2024 11:17:27 +0200 Subject: [PATCH] Update CI script for release-branch workflow --- .gitlab-ci.yml | 17 ++++++++++++----- package.json | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2477b79..58868d0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,19 +40,26 @@ build: DOCKER_TLS_CERTDIR: '' services: - docker:dind + rules: + - if: $CI_COMMIT_TAG + variables: + VERSION: $CI_COMMIT_TAG + - if: $CI_COMMIT_BRANCH =~ /^release/ || $CI_PIPELINE_SOURCE == "web" + variables: + VERSION: $CI_COMMIT_BRANCH before_script: - echo -n $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY script: - - export VERSION=$(docker run --rm -v "$PWD":/usr/src/app:ro -w /usr/src/app node:slim node -p "require('./package.json').version") - docker pull $CI_REGISTRY_IMAGE:latest || true - > docker build --pull --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$VERSION - --tag $CI_REGISTRY_IMAGE:latest . - docker push $CI_REGISTRY_IMAGE:$VERSION - - docker push $CI_REGISTRY_IMAGE:latest - only: - - main + - > + if [ $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH ]; then + docker tag $CI_REGISTRY_IMAGE:$VERSION $CI_REGISTRY_IMAGE:latest + docker push $CI_REGISTRY_IMAGE:latest + fi diff --git a/package.json b/package.json index 658ab52..5835ca6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mobicoop/matcher", - "version": "1.5.5", + "version": "1.6.0", "description": "Mobicoop V3 Matcher", "author": "sbriat", "private": true,