Update .gitlab-ci.yml file

This commit is contained in:
Lee 2023-03-08 14:00:58 +00:00
parent 06a907e812
commit bc8055758d

@ -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"
- 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