diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2e5f7049aa75412f3db8c5a7ee22ea828018a4db..1b59fb1be3b0ac3343b7595fd88ed509c4c3492f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,17 +34,19 @@ before_script: # disable console prompt for host checking - mkdir -p ~/.ssh - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config - -cache: - key: - files: - - jalhyd_branch - - package.json - paths: - - node_modules/ + # set cache key + - CACHE_KEY=$(cat jalhyd_branch) + - if [ "$CI_COMMIT_REF_NAME" = "master" ]; then CACHE_KEY="master"; fi + - if [ "$CI_COMMIT_REF_NAME" = "devel" ]; then CACHE_KEY="devel"; fi + - echo CACHE_KEY $CACHE_KEY + - export CACHE_KEY jalhyd: stage: jalhyd + cache: + key: "$CACHE_KEY" + paths: + - node_modules/ only: - pushes - tags @@ -66,6 +68,10 @@ jalhyd: install: stage: install + cache: + key: "$CACHE_KEY" + paths: + - node_modules/ only: - pushes - tags @@ -77,6 +83,10 @@ install: test: stage: test + cache: + key: "$CACHE_KEY" + paths: + - node_modules/ only: - tags - schedules @@ -86,6 +96,10 @@ test: build: stage: build + cache: + key: "$CACHE_KEY" + paths: + - node_modules/ only: - pushes - tags @@ -100,6 +114,10 @@ build: clean-stale-branches: stage: clean-stale-branches + cache: + key: "$CACHE_KEY" + paths: + - node_modules/ only: - pushes - tags @@ -109,6 +127,10 @@ clean-stale-branches: deploy-dev: stage: deploy-dev + cache: + key: "$CACHE_KEY" + paths: + - node_modules/ only: - pushes - tags @@ -121,6 +143,10 @@ deploy-dev: deploy-prod: stage: deploy-prod + cache: + key: "$CACHE_KEY" + paths: + - node_modules/ only: variables: - $CI_COMMIT_REF_NAME == "stable" @@ -131,6 +157,10 @@ deploy-prod: releases-nightly: stage: releases-nightly + cache: + key: "$CACHE_KEY" + paths: + - node_modules/ only: - schedules except: @@ -142,6 +172,10 @@ releases-nightly: releases-version: stage: releases-version + cache: + key: "$CACHE_KEY" + paths: + - node_modules/ only: variables: - $CI_COMMIT_REF_NAME =~ /^[0-9]+\.[0-9]+\.[0-9]+$/ # version tag