45 lines
1.2 KiB
YAML
45 lines
1.2 KiB
YAML
image: openjdk:17-jdk-slim
|
|
|
|
stages:
|
|
- build
|
|
- release
|
|
|
|
before_script:
|
|
# - echo `pwd` # debug
|
|
# - echo "$CI_BUILD_NAME, $CI_BUILD_REF_NAME $CI_BUILD_STAGE" # debug
|
|
- export GRADLE_USER_HOME=`pwd`/.gradle
|
|
|
|
cache:
|
|
paths:
|
|
- .gradle/wrapper
|
|
- .gradle/caches
|
|
|
|
build:
|
|
stage: build
|
|
rules:
|
|
script:
|
|
- ./gradlew assemble
|
|
artifacts:
|
|
paths:
|
|
- build/libs/*.jar
|
|
expire_in: 1 week
|
|
only:
|
|
- master
|
|
|
|
release:
|
|
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:
|
|
- echo "running release 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 |