From 3cb28dc0c1c574cb5a8ee3b33a6e7e0f2d9c1e71 Mon Sep 17 00:00:00 2001 From: DHCPCD Date: Thu, 31 Mar 2022 12:35:58 +0300 Subject: [PATCH] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b9f9003..3f80057 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,4 +9,18 @@ docker-build: # Default branch leaves tag empty (= latest tag) # All other branches are tagged with the escaped branch name (commit ref slug) script: + - | + if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then + tag="" + echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" + else + tag=":$CI_COMMIT_REF_SLUG" + echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" + fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . + # - docker push "$CI_REGISTRY_IMAGE${tag}" + # Run this job in a branch where a Dockerfile exists + rules: + - if: $CI_COMMIT_BRANCH + exists: + - OsuLazerServer/Dockerfile -- GitLab