From f833bb7d5bc928ac99846c43e6d1dea24033a502 Mon Sep 17 00:00:00 2001 From: Louis Vallat Date: Thu, 29 Oct 2020 21:05:16 +0100 Subject: [PATCH] Modified gitlab-ci again and added a stage Signed-off-by: Louis Vallat --- .gitlab-ci.yml | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 08186f1..47d7485 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,7 @@ services: stages: - build - test + - package - release # Disable the Gradle daemon for Continuous Integration servers as correctness @@ -25,7 +26,7 @@ before_script: build: image: gradle:jdk15 stage: build - script: gradle --build-cache assemble + script: gradle --build-cache buildJava cache: key: "$CI_COMMIT_REF_NAME" policy: push @@ -37,26 +38,40 @@ build: test: image: gradle:jdk15 stage: test - script: gradle check + script: gradle --build-cache check cache: key: "$CI_COMMIT_REF_NAME" policy: pull paths: - - build/libs/*.jar + - build - .gradle -release-image-test: +package: + image: gradle:jdk15 + stage: package + script: gradle --build-cache assemble + cache: + key: "$CI_COMMIT_REF_NAME" + policy: push + paths: + - build + - .gradle + artifacts: + paths: + - build/libs/*.jar + +release: stage: release script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker build . -t $CONTAINER_BRANCH_IMAGE - docker push $CONTAINER_BRANCH_IMAGE -release-image: +release-master: stage: release script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - docker build . -t $CONTAINER_BRANCH_IMAGE -t $CONTAINER_RELEASE_IMAGE - - docker push $CONTAINER_RELEASE_IMAGE $CONTAINER_BRANCH_IMAGE + - docker build . -t $CONTAINER_RELEASE_IMAGE + - docker push $CONTAINER_RELEASE_IMAGE only: - master \ No newline at end of file