introduce new kind of ci

This commit is contained in:
Michael Jerger 2023-08-08 09:18:10 +02:00
parent c1ceff0f94
commit a8b8c4e4db

View file

@ -1,5 +1,3 @@
image: openjdk:11-jdk-slim
stages: stages:
- build - build
- test - test
@ -7,6 +5,13 @@ stages:
- publish - publish
- release - release
.kotlin-job: &kotlin
image: domaindrivenarchitecture/shadow-kotlin
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .gradle/wrapper
- .gradle/caches
before_script: before_script:
- echo "---------- Start CI ----------" - echo "---------- Start CI ----------"
- export GRADLE_USER_HOME=`pwd`/.gradle - export GRADLE_USER_HOME=`pwd`/.gradle
@ -16,13 +21,15 @@ before_script:
- echo $CI_COMMIT_REF_NAME - echo $CI_COMMIT_REF_NAME
- echo "----------------------------------" - echo "----------------------------------"
cache: .tag_only: &tag_only
paths: rules:
- .gradle/wrapper - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- .gradle/caches when: never
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
build: build:
<<: *kotlin
stage: build stage: build
script: script:
- echo "---------- build stage ----------" - echo "---------- build stage ----------"
@ -60,6 +67,7 @@ test:
package: package:
<<: *kotlin
stage: package stage: package
script: script:
- ./gradlew -x assemble -x test jar - ./gradlew -x assemble -x test jar
@ -76,22 +84,18 @@ package:
publish-maven-package-to-gitlab: publish-maven-package-to-gitlab:
<<: *kotlin
<<: *tag_only
stage: publish stage: publish
rules:
- if: $CI_PIPELINE_SOURCE != "push"
when: never
- if: $CI_COMMIT_TAG !~ /^release-[0-9]+[.][0-9]+([.][0-9]+)?$/
script: script:
- ./gradlew -x assemble -x test publishLibraryPublicationToGitlabRepository - ./gradlew -x assemble -x test publishLibraryPublicationToGitlabRepository
publish-maven-package-to-meissa: publish-maven-package-to-meissa:
<<: *kotlin
<<: *tag_only
stage: publish stage: publish
allow_failure: true allow_failure: true
rules:
- if: $CI_PIPELINE_SOURCE != "push"
when: never
- if: $CI_COMMIT_TAG !~ /^release-[0-9]+[.][0-9]+([.][0-9]+)?$/
script: script:
- apt-get update -y - apt-get update -y
- apt-get install -y iputils-ping ssh - apt-get install -y iputils-ping ssh
@ -101,12 +105,9 @@ publish-maven-package-to-meissa:
release-to-gitlab: release-to-gitlab:
<<: *tag_only
image: registry.gitlab.com/gitlab-org/release-cli:latest image: registry.gitlab.com/gitlab-org/release-cli:latest
stage: release stage: release
rules:
- if: $CI_PIPELINE_SOURCE != "push"
when: never
- if: $CI_COMMIT_TAG =~ /^release-[0-9]+[.][0-9]+([.][0-9]+)?$/
artifacts: artifacts:
paths: paths:
- 'build/libs/provs-desktop.jar' - 'build/libs/provs-desktop.jar'
@ -126,15 +127,11 @@ release-to-gitlab:
release-to-meissa: release-to-meissa:
<<: *kotlin
<<: *tag_only
stage: release stage: release
allow_failure: true allow_failure: true
rules:
- if: $CI_PIPELINE_SOURCE != "push"
when: never
- if: $CI_COMMIT_TAG =~ /^release-[0-9]+[.][0-9]+([.][0-9]+)?$/
script: script:
- apt-get update
- apt-get -yqq install curl
- ./gradlew createReleaseAndUploadAssets - ./gradlew createReleaseAndUploadAssets