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: stages:
- build - build
- test - release_job
- deploy
before_script: before_script:
# - echo `pwd` # debug # - echo `pwd` # debug
@ -17,6 +16,10 @@ cache:
build: build:
stage: 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: script:
- ./gradlew assemble - ./gradlew assemble
artifacts: artifacts:
@ -26,15 +29,20 @@ build:
only: only:
- master - master
test: release_job:
stage: test 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: script:
- ./gradlew check - echo "running release_job for $TAG"
release:
deploy: name: 'Release $TAG'
stage: deploy description: 'Created using the release-cli $EXTRA_DESCRIPTION' # $EXTRA_DESCRIPTION and the $TAG
script: tag_name: '$TAG' # variables must be defined elsewhere
- ./deploy ref: '$CI_COMMIT_SHA' # in the pipeline. For example, in the
after_script:
- echo "End CI"