From bc8055758d89ccbf483cbb7233f7e17b2fc3955e Mon Sep 17 00:00:00 2001 From: Fascinated Date: Wed, 8 Mar 2023 14:00:58 +0000 Subject: [PATCH] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1f7eb3e..be6b12f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,8 +2,7 @@ image: openjdk:17-jdk-slim stages: - build - - test - - deploy + - release_job before_script: # - echo `pwd` # debug @@ -17,6 +16,10 @@ cache: build: stage: build + rules: + - if: $CI_COMMIT_TAG + when: never # Do not run this job when a tag is created manually + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch script: - ./gradlew assemble artifacts: @@ -26,15 +29,20 @@ build: only: - master -test: - stage: test +release_job: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + needs: + - job: build + artifacts: true + rules: + - if: $CI_COMMIT_TAG + when: never # Do not run this job when a tag is created manually + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch script: - - ./gradlew check - -deploy: - stage: deploy - script: - - ./deploy - -after_script: - - echo "End CI" \ No newline at end of file + - echo "running release_job for $TAG" + release: + name: 'Release $TAG' + description: 'Created using the release-cli $EXTRA_DESCRIPTION' # $EXTRA_DESCRIPTION and the $TAG + tag_name: '$TAG' # variables must be defined elsewhere + ref: '$CI_COMMIT_SHA' # in the pipeline. For example, in the \ No newline at end of file